Skip to content

Raise ParserWarning not ParserError for Pandas > 1.3.5#30

Merged
ZGainsforth merged 2 commits into
adelq:masterfrom
ExPlanetology:master
Mar 22, 2024
Merged

Raise ParserWarning not ParserError for Pandas > 1.3.5#30
ZGainsforth merged 2 commits into
adelq:masterfrom
ExPlanetology:master

Conversation

@djbower
Copy link
Copy Markdown
Contributor

@djbower djbower commented Mar 22, 2024

Raise a ParserWarning to avoid the ParserError pandas.errors.ParserError: Defining usecols with out-of-bounds indices is not allowed. when using Pandas>1.3.5. Now a warning is output for the problematic lines (which relate to comments in the JANAF data).

Tested on an example txt file: https://janaf.nist.gov/tables/H-066.txt

Raise a ParserWarning to avoid the ParserError `pandas.errors.ParserError: Defining usecols with out-of-bounds indices is not allowed.` when using Pandas>1.3.5.  Now a warning is output for the problematic lines (which relate to comments in the JANAF data).

Tested on an example txt file: https://janaf.nist.gov/tables/H-066.txt
This is related to pull request adelq#30, which requires at least Pandas 1.3.0 for the `on_bad_lines` keyword argument to be available.

See https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html
Copy link
Copy Markdown
Collaborator

@ZGainsforth ZGainsforth left a comment

Choose a reason for hiding this comment

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

OK. Ideally we should have a patch to fix bad lines if they follow a pattern in the JANAF data, but at least warning is better.

@ZGainsforth ZGainsforth merged commit f40c451 into adelq:master Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants