我知道这是一个非常普遍的错误,然而,在我的例子中,我不知道为什么会发生在我身上。在
我得到了:
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
df['time'] = pd.to_datetime(df['time'], unit='ms')
: 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
代码:
^{pr2}$你能帮我弄清楚为什么我会受到这样的警告吗?在
这是一个有据可查的警告。 解决
发生这种情况是因为
^{pr2}$df['time']
是一个视图,而不是要编辑的实际数据。 请检查代码中的其他地方,因为每当您分配类似的列时,都会弹出此警告正确的是
相关问题 更多 >
编程相关推荐