Skip to content

Commit

Permalink
fix df_features.index conține np.nan
Browse files Browse the repository at this point in the history
  • Loading branch information
zhupr authored and you-n-g committed Jul 21, 2021
1 parent 3f5334a commit bf7732e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions examples/highfreq/highfreq_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ def get_normalized_price_feature(price_field, shift=0):
]
names += ["$volume_1"]

fields += ["Cut({0}, 240, None)".format(template_paused.format("Date($close)"))]
names += ["date"]
return fields, names


Expand Down
3 changes: 3 additions & 0 deletions examples/highfreq/highfreq_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def fit(self, df_features):
self.feature_vmin[name] = np.nanmin(part_values)

def __call__(self, df_features):
df_features["date"] = pd.to_datetime(
df_features.index.get_level_values(level="datetime").to_series().dt.date.values
)
df_features.set_index("date", append=True, drop=True, inplace=True)
df_values = df_features.values
names = {
Expand Down

0 comments on commit bf7732e

Please sign in to comment.