Im desperate with this warning. I'm doing the following:
groups = df.groupby('year')
2018_group = groups.get_group('2018')
if not 2018_group['Descripcion'].empty:
desc = 2018_group.loc[2018_group['Descripcion'].notnull(), 'Desc'].copy()
2018_group.loc[:, 'Descripcion'] = desc.unique()[0]
print 2018_group
Getting the known error:
SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
2018_group.loc['Desc'] = desc.unique()[0]
What I want to do is fill the column 'Desc' with the non-empty value in that column