From db19c96a40c1320adfd496677726542fbc4aa535 Mon Sep 17 00:00:00 2001 From: "xiaowen.gcy" Date: Mon, 3 Aug 2020 13:21:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BD=BF=E7=94=A8=20p?= =?UTF-8?q?ro=5Fbar=20=E6=9F=A5=E8=AF=A2=E5=A4=9A=E4=B8=AA=E8=82=A1?= =?UTF-8?q?=E7=A5=A8=E6=97=B6=EF=BC=8C=E4=BC=9A=E5=8F=91=E7=94=9F=E4=BA=A4?= =?UTF-8?q?=E5=8F=89=E8=AE=A1=E7=AE=97=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tushare/pro/data_pro.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tushare/pro/data_pro.py b/tushare/pro/data_pro.py index 774a6c0a..5466a248 100644 --- a/tushare/pro/data_pro.py +++ b/tushare/pro/data_pro.py @@ -89,8 +89,8 @@ def pro_bar(ts_code='', pro_api=None, start_date=None, end_date=None, freq='D', if freq == 'M': df = api.monthly(ts_code=ts_code, start_date=start_date, end_date=end_date) if adj is not None: - fcts = api.adj_factor(ts_code=ts_code, start_date=start_date, end_date=end_date)[['trade_date', 'adj_factor']] - data = df.set_index('trade_date', drop=False).merge(fcts.set_index('trade_date'), left_index=True, right_index=True, how='left') + fcts = api.adj_factor(ts_code=ts_code, start_date=start_date, end_date=end_date)[['trade_date', 'ts_code', 'adj_factor']] + data = df.set_index(['trade_date', 'ts_code'], drop=False).merge(fcts.set_index(['trade_date', 'ts_code']), left_index=True, right_index=True, how='left') data['adj_factor'] = data['adj_factor'].fillna(method='bfill') for col in PRICE_COLS: if adj == 'hfq':