【发布时间】:2018-12-25 05:53:33
【问题描述】:
我不断收到此警告,但真的不知道我应该在这里更改什么:
C:\Users\3626416\Software\Anaconda\lib\site-packages\pandas\core\indexing.py:543:
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
请参阅文档中的注意事项:
http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
self.obj[item] = s
这是我的代码:
df_pcl.loc[:,['Weight','Pieces','Cons','DeadWeight']] = df_pcl.loc[:,['Weight','Pieces','Cons','DeadWeight']] * pcl2docRtio
【问题讨论】: