I try to group my dataframe in 2 ways.
1st way:
df['suma_koszty_operacyjne'] = df.groupby('EVT_ID')['koszty_operacyjne'].sum()
It doesn't work, I didn't get any errors but column 'suma_koszty_operacyjne' is empty everywhere.
2nd way:
df = df.groupby('EVT_ID')['koszty_operacyjne'].sum()
It works but I got only 2 columns from my df but I want df like before groupby with grouped column.
I want to groupby like in 1st way and get all columns. Where is the problem?