groupby.DataFrameGroupBy.count

DataFrameGroupBy.count() pd.DataFrame[source]

Compute the count value for each group.

Returns

pandas.DataFrame

nunique value for each numeric column of each group

See Also

:pandas_api_docs:`pandas.core.groupby.GroupBy.count`

Examples

>>> from tests import OPENSEARCH_TEST_CLIENT
>>> df = oml.DataFrame(
...   OPENSEARCH_TEST_CLIENT, "flights",
...   columns=["AvgTicketPrice", "Cancelled", "dayOfWeek", "DestCountry"]
... )
>>> df.groupby("DestCountry").count() 
             AvgTicketPrice  Cancelled  dayOfWeek
DestCountry
AE                       46         46         46
AR                      305        305        305
AT                      377        377        377
AU                      416        416        416
CA                      944        944        944
...                     ...        ...        ...
RU                      739        739        739
SE                      255        255        255
TR                       10         10         10
US                     1987       1987       1987
ZA                      283        283        283

[32 rows x 3 columns]