Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Fix invalid data loading in csvdir bundle #2223

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
9 changes: 6 additions & 3 deletions zipline/data/bundles/csvdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,13 @@ def _pricing_iter(csvdir, symbols, metadata, divs_splits, show_progress):
for sid, symbol in enumerate(it):
logger.debug('%s: sid %s' % (symbol, sid))

fname = symbol + '.csv'
try:
fname = [fname for fname in files
if '%s.csv' % symbol in fname][0]
except IndexError:
dfr = read_csv(os.path.join(csvdir, fname),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove the second call to read_csv() below on line 185? We're already calling it here and exiting early if we don't have the file we want.

parse_dates=[0],
infer_datetime_format=False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wouldn't we want to infer the datetime format?

index_col=0).sort_index()
except OSError:
raise ValueError("%s.csv file is not in %s" % (symbol, csvdir))

dfr = read_csv(os.path.join(csvdir, fname),
Expand Down