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

Method value_counts

dask/dataframe/dask_expr/_collection.py:4255–4285  ·  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

4253
4254 @derived_from(pd.Series)
4255 def value_counts(
4256 self,
4257 sort=None,
4258 ascending=False,
4259 dropna=True,
4260 normalize=False,
4261 split_every=None,
4262 split_out=no_default,
4263 ):
4264 if split_out is no_default:
4265 if isinstance(self.dtype, CategoricalDtype):
4266 # unobserved or huge categories will lead to oom errors
4267 if self.cat.known:
4268 split_out = 1 + len(self.dtype.categories) // 100_000
4269 else:
4270 split_out = True
4271 else:
4272 split_out = True
4273 if split_out == 1 and split_out is not True and sort is None:
4274 sort = True
4275
4276 length = None
4277 if (split_out > 1 or split_out is True) and normalize:
4278 frame = self if not dropna else self.dropna()
4279 length = Len(frame)
4280
4281 return new_collection(
4282 ValueCounts(
4283 self, sort, ascending, dropna, normalize, split_every, split_out, length
4284 )
4285 )
4286
4287 @derived_from(pd.Series)
4288 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