按日期分隔推文会发出警告

时间:2019-01-31 03:43:36

标签: pandas dataframe ipython

我能够运行代码,但是在jupyter笔记本中的单元格下面有一段很大的警告。除了它对我的代码造成很大的干扰之外,我对此没有多大意义。我需要对代码进行一些微调的帮助,以便可以将其指示的任何细微错误删除。 请不要完全给我新的代码,因为我不是编码专家。 我的代码如下:

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

而且,我得到的警告如下:

/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

我一点都不明白。 谢谢!

0 个答案:

没有答案