Help!
df = df[df.groupby('id')['metric'].transform('max')==df['metric]]
and now my other functions don't work. I tried
df.reset_index(drop = True, inplace=True)...... #nope!
I tried to start from the very beginning - import libraries and re-read csv's and nope!
what happened?
df['d_d_Mean'] = df[df.groupby('id')['drugs'].transform('max')==df['drugs']]
Error:
<ipython-input-607-85fda50bf5a4>:12: 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: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy