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

Class Moment

dask/dataframe/dask_expr/_reductions.py:1183–1219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1181
1182
1183class Moment(ArrayReduction):
1184 _parameters = ["frame", "order"]
1185
1186 @functools.cached_property
1187 def _meta(self):
1188 # Use var as proxy for result dimension
1189 return make_meta(meta_nonempty(self.frame._meta).var())
1190
1191 @property
1192 def chunk_kwargs(self):
1193 return dict(order=self.order)
1194
1195 @property
1196 def combine_kwargs(self):
1197 return self.chunk_kwargs
1198
1199 @property
1200 def aggregate_kwargs(self):
1201 return dict(
1202 order=self.order,
1203 meta=self._meta,
1204 index=self.frame.columns,
1205 )
1206
1207 @classmethod
1208 def reduction_chunk(cls, x, order):
1209 values = x.values.astype("f8")
1210 return moment_chunk(values, order=order, axis=(0,), keepdims=True)
1211
1212 @classmethod
1213 def reduction_combine(cls, parts, order):
1214 return moment_combine(parts, order=order, axis=(0,))
1215
1216 @classmethod
1217 def reduction_aggregate(cls, vals, order):
1218 result = moment_agg(vals, order=order, axis=(0,))
1219 return result
1220
1221
1222class Mean(Reduction):

Callers 2

skewMethod · 0.90
kurtosisMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected