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

Method sum

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

Source from the content-addressed store, hash-verified

472 return len(self.data)
473
474 def sum(self, axis=None, dtype=None, out=None):
475 assert out is None and dtype is None, "`out` is just for compatible with numpy's aggregating function"
476 # FIXME: weird logic and not general
477 if axis is None:
478 return np.nansum(self.data)
479 elif axis == 0:
480 tmp_data = np.nansum(self.data, axis=0)
481 return SingleData(tmp_data, self.columns)
482 elif axis == 1:
483 tmp_data = np.nansum(self.data, axis=1)
484 return SingleData(tmp_data, self.index)
485 else:
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"

Callers 15

check_missing_dataMethod · 0.45
test_simulator_stop_twapFunction · 0.45
test_interpreterFunction · 0.45
test_simulator_stop_twapFunction · 0.45
test_opsMethod · 0.45
test_squeezeMethod · 0.45
_get_active_locationsMethod · 0.45
lstm_combine_and_maskMethod · 0.45
train_epochMethod · 0.45
forwardMethod · 0.45

Calls 1

SingleDataClass · 0.85

Tested by 6

test_simulator_stop_twapFunction · 0.36
test_interpreterFunction · 0.36
test_simulator_stop_twapFunction · 0.36
test_opsMethod · 0.36
test_squeezeMethod · 0.36