问题
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