import pandas as pd
df_run = pd.read_csv('UserEventSummary.csv')
df_run.accountId[0] = 'first-' + str(df_run.accountId[0])
第三行给我这个错误:
/home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/ipykernel/__main__.py:1: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
if __name__ == '__main__':
/home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/pandas/core/indexing.py:194: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
self._setitem_with_indexer(indexer, value)
我已经阅读了有关文档,并且对何时发生有了很好的了解,但不确定为什么我会在这里找到它。我不觉得我做错了什么或危险的事!?
我猜有更好的(更正确的)方法吗?