pandas:试图在DataFram的切片副本上设置值

2024-05-06 19:56:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我对熊猫有一个非常简单的命令,比如:

volume_related_pd.loc[:,"last_record_volume"] = volume_related_pd.loc[:,"volume"]

我想复杂的是我有重复的索引。它发出警告:

/anaconda2/lib/python2.7/site-packages/pandas/core/indexing.py:601: 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

我该怎么办?谢谢。我已经用过了


Tags: 命令警告pandasvaluelibpackagessiterecord