Hoping that this is not been asked before. I am trying to groupby two columns and add the mean as a new column.
I get this message, without me being able to check how can I correct it, or if the code is actually correct
main:1: 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
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
If there is a way to bypass this warning, or to correct it. Please not that the DF is really big (half a million rows). Any help would be nice.
average_stand['mean'] = average_stand.groupby(['branch_id','bill']).transform('mean',numeric_only = False)
customer_id branch_id bill mean
144 1 1 10 13
145 1 1 16 13
146 1 2 16 16
147 2 2 14 16.5
148 2 2 19 16.5