A    B
0   Red  3.9
1   Red  4.1
2   Red  2.3
3  Blue -1.2
4  Blue -9.2
5  Blue -6.1
I want to create a new df['C'] with maximum B value, per each A group.
Output should be:
      A    B    C
0   Red  3.9  4.1
1   Red  4.1  4.1
2   Red  2.3  4.1
3  Blue -1.2 -1.2
4  Blue -9.2 -1.2
5  Blue -6.1 -1.2
I´ve tried:
df['C'] = df.groupby('A')['B'].max()
 
    