Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

bug fix: 如果日线数据中某个日期格式出错会抛异常,后面所有数据即使格式正确也无法解释出来。 #247

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pytdx/reader/daily_bar_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_df_by_file(self, fname):
data = [self._df_convert(row, coefficient) for row in self.parse_data_by_file(fname)]

df = pd.DataFrame(data=data, columns=('date', 'open', 'high', 'low', 'close', 'amount', 'volume'))
df.index = pd.to_datetime(df.date)
df.index = pd.to_datetime(df.date, errors='coerce')
return df[['open', 'high', 'low', 'close', 'amount', 'volume']]

def get_df_by_code(self, code, exchange):
Expand Down