mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-11 14:56:55 +08:00
Fixed pandas FutureWarning (#1073)
* Fixed pandas FutureWarning `FutureWarning: Passing a set as an indexer is deprecated and will raise in a future version. Use a list instead.` * fixed another pandas FutureWarning ``` scripts/data_collector/index.py:228: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. new_df = new_df.append(_tmp_df, sort=False) ``` * fixed more pandas futurewarnings
This commit is contained in:
@@ -245,7 +245,7 @@ class YahooCollectorCN1d(YahooCollectorCN):
|
||||
_path = self.save_dir.joinpath(f"sh{_index_code}.csv")
|
||||
if _path.exists():
|
||||
_old_df = pd.read_csv(_path)
|
||||
df = _old_df.append(df, sort=False)
|
||||
df = pd.concat([_old_df, df], sort=False)
|
||||
df.to_csv(_path, index=False)
|
||||
time.sleep(5)
|
||||
|
||||
@@ -404,7 +404,7 @@ class YahooNormalize(BaseNormalize):
|
||||
.index
|
||||
)
|
||||
df.sort_index(inplace=True)
|
||||
df.loc[(df["volume"] <= 0) | np.isnan(df["volume"]), set(df.columns) - {symbol_field_name}] = np.nan
|
||||
df.loc[(df["volume"] <= 0) | np.isnan(df["volume"]), list(set(df.columns) - {symbol_field_name})] = np.nan
|
||||
|
||||
change_series = YahooNormalize.calc_change(df, last_close)
|
||||
# NOTE: The data obtained by Yahoo finance sometimes has exceptions
|
||||
|
||||
Reference in New Issue
Block a user