Created
February 4, 2021 08:12
-
-
Save Everfighting/020d58c67ec5cc986ae6b2f7186db7ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s=pd.Series([11,12,13],name='S') | |
data=np.arange(21,24) | |
df=pd.DataFrame({'A':[31,32,33],'B':[41,42,43]}) | |
fun=lambda x:x.A+x.B | |
df.assign(C=fun,D=df.A+df.B,E=s,F=data)#增加新列 | |
A B C D E F | |
0 31 41 72 72 11 21 | |
1 32 42 74 74 12 22 | |
2 33 43 76 76 13 23 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment