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

Method value_counts

dask/dataframe/dask_expr/_collection.py:4297–4327  ·  view source on GitHub ↗
(
        self,
        sort=None,
        ascending=False,
        dropna=True,
        normalize=False,
        split_every=None,
        split_out=no_default,
    )

Source from the content-addressed store, hash-verified

4295
4296 @derived_from(pd.Series)
4297 def value_counts(
4298 self,
4299 sort=None,
4300 ascending=False,
4301 dropna=True,
4302 normalize=False,
4303 split_every=None,
4304 split_out=no_default,
4305 ):
4306 if split_out is no_default:
4307 if isinstance(self.dtype, CategoricalDtype):
4308 # unobserved or huge categories will lead to oom errors
4309 if self.cat.known:
4310 split_out = 1 + len(self.dtype.categories) // 100_000
4311 else:
4312 split_out = True
4313 else:
4314 split_out = True
4315 if split_out == 1 and split_out is not True and sort is None:
4316 sort = True
4317
4318 length = None
4319 if (split_out > 1 or split_out is True) and normalize:
4320 frame = self if not dropna else self.dropna()
4321 length = Len(frame)
4322
4323 return new_collection(
4324 ValueCounts(
4325 self, sort, ascending, dropna, normalize, split_every, split_out, length
4326 )
4327 )
4328
4329 @derived_from(pd.Series)
4330 def mode(self, dropna=True, split_every=False):

Callers 15

assert_eq_dtypesFunction · 0.45
_value_countsFunction · 0.45
_metaMethod · 0.45
infoMethod · 0.45
test_value_countsFunction · 0.45
test_value_countsFunction · 0.45
test_value_counts_sortFunction · 0.45

Calls 4

dropnaMethod · 0.95
LenClass · 0.90
new_collectionFunction · 0.90
ValueCountsClass · 0.90