I'm trying to just get the sum of 'ride_value' by this groupby. How do I do that?
df.groupby(['start_lat_3', 'start_lng_3'])['ride_value'].agg(['sum'])
I'm trying to do this:
df['sum'] = df.groupby(['start_lat_3', 'start_lng_3'])['ride_value'].agg(['sum'])
But of course, that doesn't work because the right-hand side is a Pandas DataFrame.
I tried:
df.groupby(['start_lat_3', 'start_lng_3'])['ride_value'].agg(['sum'])[2]
df.groupby(['start_lat_3', 'start_lng_3'])['ride_value'].agg(['sum'])[['sum']]
df.groupby(['start_lat_3', 'start_lng_3'])['ride_value'].agg(['sum'])['sum']