MCPcopy
hub / github.com/microsoft/qlib / mean

Method mean

qlib/utils/index_data.py:488–500  ·  view source on GitHub ↗
(self, axis=None, dtype=None, out=None)

Source from the content-addressed store, hash-verified

486 raise ValueError(f"axis must be None, 0 or 1")
487
488 def mean(self, axis=None, dtype=None, out=None):
489 assert out is None and dtype is None, "`out` is just for compatible with numpy's aggregating function"
490 # FIXME: weird logic and not general
491 if axis is None:
492 return np.nanmean(self.data)
493 elif axis == 0:
494 tmp_data = np.nanmean(self.data, axis=0)
495 return SingleData(tmp_data, self.columns)
496 elif axis == 1:
497 tmp_data = np.nanmean(self.data, axis=1)
498 return SingleData(tmp_data, self.index)
499 else:
500 raise ValueError(f"axis must be None, 0 or 1")
501
502 def isna(self):
503 return self.__class__(np.isnan(self.data), *self.indices)

Callers 15

test_CSZScoreNormMethod · 0.45
test_simulator_stop_twapFunction · 0.45
test_twap_strategyFunction · 0.45
test_cn_ppo_strategyFunction · 0.45
test_simulator_stop_twapFunction · 0.45
test_squeezeMethod · 0.45
cal_mean_stdFunction · 0.45
generate_orderFunction · 0.45
vis_data.pyFile · 0.45
fill_test_naFunction · 0.45
__call__Method · 0.45

Calls 1

SingleDataClass · 0.85

Tested by 15

test_CSZScoreNormMethod · 0.36
test_simulator_stop_twapFunction · 0.36
test_twap_strategyFunction · 0.36
test_cn_ppo_strategyFunction · 0.36
test_simulator_stop_twapFunction · 0.36
test_squeezeMethod · 0.36
test_epochMethod · 0.36
test_epochMethod · 0.36
test_epochMethod · 0.36
test_epochMethod · 0.36
test_epochMethod · 0.36
test_epochMethod · 0.36