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

Class Moment

dask/dataframe/dask_expr/_reductions.py:1185–1221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

skewMethod · 0.90
kurtosisMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected