Skip to content

Commit 06c90d6

Browse files
authored
Merge pull request #350 from zhupr/fix_dump_bin
Fix dump_bin.py && check_dump_bin.py
2 parents f72771c + d245242 commit 06c90d6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

scripts/check_dump_bin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __init__(
6666
self.csv_files = sorted(csv_path.glob(f"*{file_suffix}") if csv_path.is_dir() else [csv_path])
6767

6868
if check_fields is None:
69-
check_fields = list(map(lambda x: x.split(".")[0], bin_path_list[0].glob(f"*.bin")))
69+
check_fields = list(map(lambda x: x.name.split(".")[0], bin_path_list[0].glob(f"*.bin")))
7070
else:
7171
check_fields = check_fields.split(",") if isinstance(check_fields, str) else check_fields
7272
self.check_fields = list(map(lambda x: x.strip(), check_fields))
@@ -91,6 +91,7 @@ def _compare(self, file_path: Path):
9191
origin_df[self.symbol_field_name] = symbol
9292
origin_df.set_index([self.symbol_field_name, self.date_field_name], inplace=True)
9393
origin_df.index.names = qlib_df.index.names
94+
origin_df = origin_df.reindex(qlib_df.index)
9495
try:
9596
compare = datacompy.Compare(
9697
origin_df,

scripts/dump_bin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def _data_to_bin(self, df: pd.DataFrame, calendar_list: List[pd.Timestamp], feat
219219
# used when creating a bin file
220220
date_index = self.get_datetime_index(_df, calendar_list)
221221
for field in self.get_dump_fields(_df.columns):
222-
bin_path = features_dir.joinpath(f"{field}.{self.freq}{self.DUMP_FILE_SUFFIX}")
222+
bin_path = features_dir.joinpath(f"{field.lower()}.{self.freq}{self.DUMP_FILE_SUFFIX}")
223223
if field not in _df.columns:
224224
continue
225225
if bin_path.exists() and self._mode == self.UPDATE_MODE:

0 commit comments

Comments
 (0)