在熊猫中进行日期时间对话时获取“ SettingWithCopyWarning”

时间:2020-01-16 02:07:56

标签: python pandas dataframe datetime

我正在尝试将datetime字段转换为大熊猫中的日期。

我的代码

final_result['DATE_TO'] = pd.to_datetime(final_result['DATE_TO'], utc=True, dayfirst=True).dt.date

来自Python的警告消息

/opt/app-root/lib/python3.6/site-packages/ipykernel_launcher.py:1: 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

样本数据

final_result['DATE_TO_']
0      2020-01-26 10:07:02
1      2019-11-27 06:12:12
2      2019-12-11 08:00:08
3      2019-12-05 11:20:03
4      2019-12-07 04:50:10

如何解决此问题。

0 个答案:

没有答案