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

ENH: Raise ParserError instead of IndexError when specifying an incorrect number of columns with index_col for the read_csv C parser. #48774

Merged
merged 6 commits into from
Sep 27, 2022

Conversation

DriesSchaumont
Copy link
Member

@DriesSchaumont DriesSchaumont commented Sep 25, 2022

…number of columns with index_col for the read_csv C parser.
@DriesSchaumont DriesSchaumont marked this pull request as ready for review September 25, 2022 19:53
@DriesSchaumont DriesSchaumont added Enhancement Error Reporting Incorrect or improved errors from pandas labels Sep 26, 2022
@@ -35,7 +35,7 @@ Other enhancements
- Added ``index`` parameter to :meth:`DataFrame.to_dict` (:issue:`46398`)
- Added metadata propagation for binary operators on :class:`DataFrame` (:issue:`28283`)
- :class:`.CategoricalConversionWarning`, :class:`.InvalidComparison`, :class:`.InvalidVersion`, :class:`.LossySetitemError`, and :class:`.NoBufferPresent` are now exposed in ``pandas.errors`` (:issue:`27656`)
-
- :func:`read_csv`: specifying an incorrect number of columns with ``index_col`` of now raises ``ParserError`` instead of ``IndexError`` when using the c parser.
Copy link
Member

Choose a reason for hiding this comment

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

Could you put this under Other API changes? While this is an improvement, this is technically changing the exception class (albeit for the better)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, done

@mroeschke mroeschke added this to the 1.6 milestone Sep 27, 2022
@mroeschke mroeschke merged commit 0e93caf into pandas-dev:main Sep 27, 2022
@mroeschke
Copy link
Member

Thanks @DriesSchaumont

@mroeschke mroeschke modified the milestones: 1.6, 2.0 Oct 13, 2022
noatamir pushed a commit to noatamir/pandas that referenced this pull request Nov 9, 2022
…rect number of columns with index_col for the read_csv C parser. (pandas-dev#48774)

* Raise ParserError instead of IndexError when specifying an incorrect number of columns with index_col for the read_csv C parser.

* Move whatsnew entry

* Cleanup after moving whatsnew

* Cleanup after moving whatsnew (pt. 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IndexError raised on invalid csv file
2 participants