因此,我尝试合并“主要类型”和“描述”以创建新列。熊猫库告诉我我不能。并引发警告。我看过教程,但仍然不明白。 df_final
是实际的数据帧
df_final['Details'] = df_final['Primary Type'] + ', ' + df_final['Description']
我试图用不同的方式重写代码,但徒劳无功。 谁能解释,解决这个问题的正确方法是什么? 顺便说一句,这是错误消息
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_final['Details'] = df_final['Primary Type'] + ', ' +
df_final['Description']