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

Method value_counts

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

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