SettingWithCopyWarning: A value is trying to be set on a copy of a slice fro
错误代码:
while i < len(data_csv_data):if data_csv_data['flowmember'][i] == j:data_csv_data['label'][i] = data_csv_label['label'][j-1]data_csv_data['classes'][i]=data_csv_label['classes'][j-1]
原因:dataframe不能直接赋值,赋值用loc定位修改。
修改后:
if data_csv_data['flowmember'][i] == j:data_csv_data.loc[i, 'label'] = data_csv_label['label'][j-1]data_csv_data.loc[i, 'classes'] = data_csv_label['classes'][j-1]