This code is pandas.
pandas_reserve_tb \
.groupby(['hotel_id', 'people_num'])['total_price'] \
.sum().reset_index()
I would like to change this code to polars.
polars_researve_tb \
.group_by("hotel_id", "people_num")['total_price'] \
.sum().with_row_index()
But, I got the error
"TypeError: 'GroupBy' object is not subscriptable"
How to solve this error?
You probably meant
polars_researve_tb \
.group_by("hotel_id", "people_num").agg(pl.col('total_price').sum())
I'd advise posting reproducible examples in the future