mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-13 07:46:53 +08:00
Merge pull request #350 from zhupr/fix_dump_bin
Fix dump_bin.py && check_dump_bin.py
This commit is contained in:
@@ -66,7 +66,7 @@ class CheckBin:
|
|||||||
self.csv_files = sorted(csv_path.glob(f"*{file_suffix}") if csv_path.is_dir() else [csv_path])
|
self.csv_files = sorted(csv_path.glob(f"*{file_suffix}") if csv_path.is_dir() else [csv_path])
|
||||||
|
|
||||||
if check_fields is None:
|
if check_fields is None:
|
||||||
check_fields = list(map(lambda x: x.split(".")[0], bin_path_list[0].glob(f"*.bin")))
|
check_fields = list(map(lambda x: x.name.split(".")[0], bin_path_list[0].glob(f"*.bin")))
|
||||||
else:
|
else:
|
||||||
check_fields = check_fields.split(",") if isinstance(check_fields, str) else check_fields
|
check_fields = check_fields.split(",") if isinstance(check_fields, str) else check_fields
|
||||||
self.check_fields = list(map(lambda x: x.strip(), check_fields))
|
self.check_fields = list(map(lambda x: x.strip(), check_fields))
|
||||||
@@ -91,6 +91,7 @@ class CheckBin:
|
|||||||
origin_df[self.symbol_field_name] = symbol
|
origin_df[self.symbol_field_name] = symbol
|
||||||
origin_df.set_index([self.symbol_field_name, self.date_field_name], inplace=True)
|
origin_df.set_index([self.symbol_field_name, self.date_field_name], inplace=True)
|
||||||
origin_df.index.names = qlib_df.index.names
|
origin_df.index.names = qlib_df.index.names
|
||||||
|
origin_df = origin_df.reindex(qlib_df.index)
|
||||||
try:
|
try:
|
||||||
compare = datacompy.Compare(
|
compare = datacompy.Compare(
|
||||||
origin_df,
|
origin_df,
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class DumpDataBase:
|
|||||||
# used when creating a bin file
|
# used when creating a bin file
|
||||||
date_index = self.get_datetime_index(_df, calendar_list)
|
date_index = self.get_datetime_index(_df, calendar_list)
|
||||||
for field in self.get_dump_fields(_df.columns):
|
for field in self.get_dump_fields(_df.columns):
|
||||||
bin_path = features_dir.joinpath(f"{field}.{self.freq}{self.DUMP_FILE_SUFFIX}")
|
bin_path = features_dir.joinpath(f"{field.lower()}.{self.freq}{self.DUMP_FILE_SUFFIX}")
|
||||||
if field not in _df.columns:
|
if field not in _df.columns:
|
||||||
continue
|
continue
|
||||||
if bin_path.exists() and self._mode == self.UPDATE_MODE:
|
if bin_path.exists() and self._mode == self.UPDATE_MODE:
|
||||||
|
|||||||
Reference in New Issue
Block a user