【发布时间】:2020-12-12 10:57:15
【问题描述】:
使用df.drop(),我从df 中删除了“ID”列,现在我想返回该列。
df.drop('ID', axis=1, inplace=True)
df
# shows me df without ID column
我应该使用什么方法?
【问题讨论】:
-
在这种情况下,我将该列保存在变量中,然后删除原始列。
-
您无法找回被
inplace=True删除的列。
标签: python pandas dataframe return drop