我一直收到这个警告,但我真的不知道我应该在这里改变什么:
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
这是我的代码:
df_pcl.loc[:,['Weight','Pieces','Cons','DeadWeight']] = df_pcl.loc[:,['Weight','Pieces','Cons','DeadWeight']] * pcl2docRtio
我找到了根本原因。必须使用df_pcl=source_航向位置[idx,:].copy()而不是df_pcl=source_航向位置[idx,:]。在
相关问题 更多 >
编程相关推荐