Get all keys from GroupBy object in Pandas

后端 未结 3 645
小鲜肉
小鲜肉 2020-12-28 12:55

I\'m looking for a way to get a list of all the keys in a GroupBy object, but I can\'t seem to find one via the docs nor through Google.

There is definitely a way t

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-28 13:20

    Use the option sort=False to have group key order reserved gp = df.groupby('group', sort=False)

提交回复
热议问题