MCPcopy
hub / github.com/pandas-dev/pandas / groupby

Method groupby

pandas/core/series.py:2040–2066  ·  view source on GitHub ↗
(
        self,
        by=None,
        level: IndexLabel | None = None,
        as_index: bool = True,
        sort: bool = True,
        group_keys: bool = True,
        observed: bool = True,
        dropna: bool = True,
    )

Source from the content-addressed store, hash-verified

2038 Pandas4Warning, allowed_args=["self", "by", "level"], name="groupby"
2039 )
2040 def groupby(
2041 self,
2042 by=None,
2043 level: IndexLabel | None = None,
2044 as_index: bool = True,
2045 sort: bool = True,
2046 group_keys: bool = True,
2047 observed: bool = True,
2048 dropna: bool = True,
2049 ) -> SeriesGroupBy:
2050 from pandas.core.groupby.generic import SeriesGroupBy
2051
2052 if level is None and by is None:
2053 raise TypeError("You have to supply one of 'by' and 'level'")
2054 if not as_index:
2055 raise TypeError("as_index=False only valid with DataFrame")
2056
2057 return SeriesGroupBy(
2058 obj=self,
2059 keys=by,
2060 level=level,
2061 as_index=as_index,
2062 sort=sort,
2063 group_keys=group_keys,
2064 observed=observed,
2065 dropna=dropna,
2066 )
2067
2068 # ----------------------------------------------------------------------
2069 # Statistics, overridden ndarray methods

Calls 1

SeriesGroupByClass · 0.90