Pandas SettingWithCopyWarning [duplicate]
This question already has an answer here: How to deal with SettingWithCopyWarning in Pandas? 13 answers Python 3.4 and Pandas 0.15.0 df is a dataframe and col1 is a column. With the code below, I'm checking for the presence of the value 10 and replacing such values with 1000. df.col1[df.col1 == 10] = 1000 Here's another example. This time, I'm changing values in col2 based on index. df.col2[df.index == 151] = 500 Both these produce the warning below: -c:1: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the the caveats in the documentation: http:/