diff --git a/adata/stock/market/stock_market/stock_market_baidu.py b/adata/stock/market/stock_market/stock_market_baidu.py index d13c31a..0e36332 100644 --- a/adata/stock/market/stock_market/stock_market_baidu.py +++ b/adata/stock/market/stock_market/stock_market_baidu.py @@ -77,6 +77,8 @@ class StockMarketBaiDu(StockMarketTemplate): rename_columns = {'turnoverratio': 'turnover_ratio', 'preClose': 'pre_close', 'range': 'change', 'ratio': 'change_pct', 'time': 'trade_time'} result_df = pd.DataFrame(data=data, columns=keys).rename(columns=rename_columns)[self._MARKET_COLUMNS] + if result_df.empty: + return pd.DataFrame(data=[], columns=self._MARKET_COLUMNS) result_df['stock_code'] = stock_code result_df['trade_date'] = result_df['trade_time'] result_df['trade_time'] = pd.to_datetime(result_df['trade_time']).dt.strftime('%Y-%m-%d %H:%M:%S') diff --git a/requirements.txt b/requirements.txt index 58f850c..a38d028 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ requests>=2.16.0 -pandas>=1.1.5 +pandas>=0.22.0 beautifulsoup4>=4.0.2 py_mini_racer>=0.6.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 22f5d72..fa4115c 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ with open("README.md", "r", encoding='utf-8') as f: requires = [ "requests>=2.16.0", - "pandas>=1.1.5", + "pandas>=0.22.0", "beautifulsoup4>=4.0.2", "py_mini_racer>=0.6.0", ]