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

Check for whitespace in column names when column not found. #567

Merged
merged 6 commits into from
Nov 1, 2022
Merged
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
Prev Previous commit
Next Next commit
fix bug that was trashing "Close" values
  • Loading branch information
DanielGoldfarb committed Nov 1, 2022
commit d63f27f312783c9a695daf07593409fcc0e3582c
8 changes: 4 additions & 4 deletions src/mplfinance/_arg_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def _check_and_prepare_data(data, config):
expect_cols = columns
else:
expect_cols = cols

for c in expect_cols:
if c not in data.columns:
for col in expect_cols:
if col not in data.columns:
for dc in data.columns:
if dc.strip() != dc:
warnings.warn('\n ================================================================= '+
'\n Input DataFrame column name "'+dc+'" '+
'\n contains leading and/or trailing whitespace.',category=UserWarning)
raise ValueError('Column "'+c+'" NOT FOUND in Input DataFrame!'+
raise ValueError('Column "'+col+'" NOT FOUND in Input DataFrame!'+
'\n CHECK that your column names are correct AND/OR'+
'\n CHECK for leading or trailing blanks in your column names.')

Expand Down