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

Method add

qlib/utils/index_data.py:595–602  ·  view source on GitHub ↗
(self, other: SingleData, fill_value=0)

Source from the content-addressed store, hash-verified

593 return SingleData(tmp_data, index)
594
595 def add(self, other: SingleData, fill_value=0):
596 # TODO: add and __add__ are a little confusing.
597 # This could be a more general
598 common_index = self.index | other.index
599 common_index, _ = common_index.sort()
600 tmp_data1 = self.reindex(common_index, fill_value)
601 tmp_data2 = other.reindex(common_index, fill_value)
602 return tmp_data1.fillna(fill_value) + tmp_data2.fillna(fill_value)
603
604 def to_dict(self):
605 """convert SingleData to dict.

Callers 5

test_opsMethod · 0.95
on_env_stepMethod · 0.45
forwardMethod · 0.45
on_env_stepMethod · 0.45
chain_dedupFunction · 0.45

Calls 3

reindexMethod · 0.95
sortMethod · 0.80
fillnaMethod · 0.80

Tested by 2

test_opsMethod · 0.76
on_env_stepMethod · 0.36