如何获得pandas中groupby对象的组数量? [英] How to get number of groups in a groupby object in pandas?

查看:179
本文介绍了如何获得pandas中groupby对象的组数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很有用,所以我知道有多少独特的组必须进行计算。谢谢。



假设groupby对象叫做 dfgroup #groupby-object-attributes>记录在案,你可以得到 len(dfgroup)的组数。


This would be useful so I know how many unique groups I have to perform calculations on. Thank you.

Suppose groupby object is called dfgroup.

解决方案

As documented, you can get the number of groups with len(dfgroup).

这篇关于如何获得pandas中groupby对象的组数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆