print(df)
Names Maths Physics Chemistry
0 Khaja 75 91 84
1 Srihari 81 89 71
2 Krishna 69 77 76
3 jain 87 69 68
4 shakir 79 70 74
df.drop(['Chemistry'],axis=1,inplace=True)
df
Names Maths Physics
0 Khaja 75 91
1 Srihari 81 89
2 Krishna 69 77
3 jain 87 69
4 shakir 79 70
How to get back the dropped column from the table. I tried to get back the column with reset_drop() but it doesn't work.
The final outcome should look like this:
print(df)
Names Maths Physics Chemistry
0 Khaja 75 91 84
1 Srihari 81 89 71
2 Krishna 69 77 76
3 jain 87 69 68
4 shakir 79 70 74
拥有一个主数据帧,然后在其中执行操作总是一个好的做法 我建议保持最佳命名实践,并给出子集数据帧有意义的名称。你知道吗
使用^{} 提取列到} 添加到
Series
,使用^{DataFrame
的末尾:如果列不是最后一个,则按原始列添加^{} :
相关问题 更多 >
编程相关推荐