Pandas SettingWithCopyWarning [duplicate]

The issue here is that: df.col1[df.col1 == 10] returns a copy.

So I would say:

row_index = df.col1 == 10
# then with the form .loc[row_indexer,col_indexer]
df.loc[row_index, 'col1'] = 100

Leave a Comment