From 8bf2678676f9bd5b74c6bd4d80ef81182f8d89c7 Mon Sep 17 00:00:00 2001 From: Andy li Date: Fri, 3 Nov 2023 17:03:11 +0800 Subject: [PATCH] fix the warning (#1656) --- scripts/dump_bin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/dump_bin.py b/scripts/dump_bin.py index 269366f75e..f8fcccfba9 100644 --- a/scripts/dump_bin.py +++ b/scripts/dump_bin.py @@ -135,7 +135,7 @@ def _get_date( def _get_source_data(self, file_path: Path) -> pd.DataFrame: df = pd.read_csv(str(file_path.resolve()), low_memory=False) - df[self.date_field_name] = df[self.date_field_name].astype(str).astype(np.datetime64) + df[self.date_field_name] = df[self.date_field_name].astype(str).astype("datetime64[ns]") # df.drop_duplicates([self.date_field_name], inplace=True) return df @@ -195,7 +195,7 @@ def save_instruments(self, instruments_data: Union[list, pd.DataFrame]): def data_merge_calendar(self, df: pd.DataFrame, calendars_list: List[pd.Timestamp]) -> pd.DataFrame: # calendars calendars_df = pd.DataFrame(data=calendars_list, columns=[self.date_field_name]) - calendars_df[self.date_field_name] = calendars_df[self.date_field_name].astype(np.datetime64) + calendars_df[self.date_field_name] = calendars_df[self.date_field_name].astype("datetime64[ns]") cal_df = calendars_df[ (calendars_df[self.date_field_name] >= df[self.date_field_name].min()) & (calendars_df[self.date_field_name] <= df[self.date_field_name].max())