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

Method normalize

tests/data_mid_layer_tests/test_processor.py:15–24  ·  view source on GitHub ↗
(df)

Source from the content-addressed store, hash-verified

13
14 def test_MinMaxNorm(self):
15 def normalize(df):
16 min_val = np.nanmin(df.values, axis=0)
17 max_val = np.nanmax(df.values, axis=0)
18 ignore = min_val == max_val
19 for _i, _con in enumerate(ignore):
20 if _con:
21 max_val[_i] = 1
22 min_val[_i] = 0
23 df.loc(axis=1)[df.columns] = (df.values - min_val) / (max_val - min_val)
24 return df
25
26 origin_df = D.features([self.TEST_INST], ["$high", "$open", "$low", "$close"]).tail(10)
27 origin_df["test"] = 0

Callers

nothing calls this directly

Calls 1

locMethod · 0.45

Tested by

no test coverage detected