Segregating tweets by dates gives warning

偶尔善良 提交于 2019-12-13 04:12:44

问题


I am able to run a code, but there is a big paragraph of warning that comes below the cell in jupyter notebook. I am not able to make much sense out of it except the fact it creates a big distraction to my code. All I need a bit of tweaking help on my code so that whatever slight error it indicates can be weaned away. Please do not give me altogether new code because I am not a coding professional. My code is as follows:

#segregating tweets2 based on dates.
tweets2['date'] = pd.to_datetime(tweets2['created_at'], errors='coerce')
tweets2['date2'] = tweets2.date.dt.strftime('%d%m%Y')

And, the warning I get is as follows:

/usr/lib/python3/dist-packages/ipykernel_launcher.py:2: 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

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy

/usr/lib/python3/dist-packages/ipykernel_launcher.py:3: 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

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  This is separate from the ipykernel package so we can avoid doing imports until

I do not understand this a bit. thanks!

来源:https://stackoverflow.com/questions/54452965/segregating-tweets-by-dates-gives-warning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!