BUG: raise helpful errors for unsupported pyarrow read_csv usage#65862
Draft
jbrockmendel wants to merge 1 commit into
Draft
BUG: raise helpful errors for unsupported pyarrow read_csv usage#65862jbrockmendel wants to merge 1 commit into
jbrockmendel wants to merge 1 commit into
Conversation
The remaining pyarrow-engine read_csv xfails were cases where unsupported usage produced a cryptic exception or silently-wrong results: - list-valued header (MultiIndex columns) now raises an informative ValueError instead of "TypeError: an integer is required"; header=[N] is treated as header=N - names with an integer header was silently ignored; the header row is now discarded and names applied, matching other engines - too many names now raises "Number of passed names did not match number of header fields in the file" like the python engine - na_filter=False was silently ignored; it now raises the standard unsupported-option ValueError - tuple names now produce MultiIndex columns like other engines Convert the affected xfails to assert the errors; remove xfails from 11 tests that now pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
d88bfe1 to
dae5e52
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the pyarrow-engine xfail cleanup (GH-65859): the remaining
read_csvpyarrow xfails were cases where unsupported usage produced a cryptic exception or silently-wrong results. This PR makes them raise informative errors (or behave like the other engines where the fix was simple) and converts the corresponding xfails to assert those errors.header(MultiIndex columns, unsupported bypyarrow.csv) now raisesValueError: header argument must be an integer or None when using engine='pyarrow'instead ofTypeError: an integer is required; singletonheader=[N]now behaves likeheader=Nnamestogether with an integerheaderwas silently ignored; the header row is now discarded andnamesapplied, matching other engines (including implicit-index handling whennamesis shorter than the file width)names(or anames/usecolslength mismatch) now raises "Number of passed names did not match number of header fields in the file" like the python enginena_filter=Falsewas silently ignored (NA filtering happened anyway); it now raises the standard unsupported-optionValueErrornamesnow produce MultiIndex columns like other engines~30 xfailed tests converted to the raise-assert pattern; 11 tests now pass outright and lost their xfails.
Note: touches the same areas of
arrow_parser_wrapper.pyas GH-65859, so whichever merges second will need minor conflict resolution.🤖 Generated with Claude Code