买菜王子 2022-06-20 00:14
浏览 5
已结题

参照EXCEL分列后直接赋值报了警告

contact2 = contact1['合同经办人'].str.split('--', expand=True)
我之前把“合同经办人”列分列了,对分列后的第2列直接赋值到新的”经办人名称“列,出了个警告,请问是什么原因,怎么解决,谢谢

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: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
contact1.loc[:,'经办人名称'] = contact2[1]

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 6月28日
    • 创建了问题 6月20日