- Should I really care about the warning?
It depends. In your example you are first referring to a subset of the data(df.loc[555]) and then setting values on this subset. Almost always pandas makes a copy of the original data and setting values on the copy will not modify the original Dataframe, hence the warning.
In some cases pandas will make a view of the original data(ex: if all columns have the same dtype.), setting values here will work as expected.
If all columns in your dataframe have the same dtype(ex: all floats) and you are using iloc on a single existing index then you are getting a view and the warning can be ignored. If you are setting on a non-existing index the you are Setting with enlargment, this is also the expected behaviour and the warning can also be ignored.
- What is the recommended way to go about this so that the warning doesn't pop up?
Your use of df.loc given the info you provided seems alright. You have several alternatives to avoid the warning:
First, update your version of pandas. The situation with these false positive warnings has been improving with each version, I don't get any in 0.15.1.
Second, If you are sure that what you are doing is the intended behaviour then you can just silence the warning globally with:
pd.set_option('chained_assignment', None)
Finally, in some cases you can set the is_copy property of your resulting object effectively disabling the checks on this object, for example:
df_temp = df.loc[555]
df_temp.is_copy = False
Note that this last option can only be used on existing indexes, on new indexes this raises a KeyError.