我有一行代码返回了警告:
我正在尝试使用以下方法将数据框(test
)中的列格式更改为日期时间:
test['Status change date'] = pd.to_datetime(test['Status change date'])
似乎已应用更改,但是我想知道为什么在下面给出警告。还有另一种方法吗?
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
test['Status change date'] = test['Status change date'].dt.strftime('%d/%m/%Y')
C:\Users\stacey\Documents\Scripts\Validations.py:106: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
非常感谢