I am doing the following operation with pandas
:
I select a subset of the data frame
data_for_model = data[['dt', 'y']]
and then I do the following:
data_for_model['y'] = data_for_model['y'].apply(lambda x: x / 60.0)
Here I hit the warning:
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
So, I am not sure how to fix it in this case. I tried this:
data_for_model.loc[:, 'y'] = data_for_model.loc[:, 'y'].apply(lambda x: x / 60.0)
However, the warning persists.