MCPcopy Create free account
hub / github.com/dask/dask / __init__

Method __init__

dask/dataframe/dask_expr/_groupby.py:2197–2233  ·  view source on GitHub ↗
(
        self,
        obj,
        by,
        group_keys=True,
        sort=None,
        observed=None,
        dropna=None,
        slice=None,
    )

Source from the content-addressed store, hash-verified

2195
2196class SeriesGroupBy(GroupBy):
2197 def __init__(
2198 self,
2199 obj,
2200 by,
2201 group_keys=True,
2202 sort=None,
2203 observed=None,
2204 dropna=None,
2205 slice=None,
2206 ):
2207 # Raise pandas errors if applicable
2208 if isinstance(obj, Series):
2209 if isinstance(by, FrameBase):
2210 obj._meta.groupby(by._meta, **_as_dict("observed", observed))
2211 elif isinstance(by, (list, tuple)) and any(
2212 isinstance(x, FrameBase) for x in by
2213 ):
2214 metas = [x._meta if isinstance(x, FrameBase) else x for x in by]
2215 obj._meta.groupby(metas, **_as_dict("observed", observed))
2216 elif isinstance(by, list):
2217 if len(by) == 0:
2218 raise ValueError("No group keys passed!")
2219
2220 non_series_items = [item for item in by if not isinstance(item, Series)]
2221 obj._meta.groupby(non_series_items, **_as_dict("observed", observed))
2222 else:
2223 obj._meta.groupby(by, **_as_dict("observed", observed))
2224
2225 super().__init__(
2226 obj,
2227 by=by,
2228 group_keys=group_keys,
2229 slice=slice,
2230 observed=observed,
2231 dropna=dropna,
2232 sort=sort,
2233 )
2234
2235 @derived_from(pd.core.groupby.SeriesGroupBy)
2236 def value_counts(self, **kwargs):

Callers

nothing calls this directly

Calls 4

_as_dictFunction · 0.85
anyFunction · 0.85
groupbyMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected