Skip to content

REGR: read_csv raising when dtypes is specified with usecols #54881

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

Merged
merged 4 commits into from
Sep 1, 2023

Conversation

phofl
Copy link
Member

@phofl phofl commented Aug 30, 2023

@phofl phofl added Regression Functionality that used to work in a prior pandas version IO CSV read_csv, to_csv labels Aug 30, 2023
@phofl phofl added this to the 2.1.1 milestone Aug 30, 2023
@@ -1176,7 +1176,7 @@ def _set_no_thousand_columns(self) -> set[int]:
)
if self.columns and self.dtype:
assert self._col_indices is not None
for i in self._col_indices:
for i, idx in enumerate(self._col_indices):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
for i, idx in enumerate(self._col_indices):
for i, col in zip(self._col_indices, self.columns):

and then self.columns[i] can just be replaced with col?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep thx

@mroeschke mroeschke merged commit 75781c2 into pandas-dev:main Sep 1, 2023
@mroeschke
Copy link
Member

Thanks @phofl

@lumberbot-app
Copy link

lumberbot-app bot commented Sep 1, 2023

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout 2.1.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 75781c26d174b35a8ce3e788201bc949fb92be02
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #54881: REGR: read_csv raising when dtypes is specified with usecols'
  1. Push to a named branch:
git push YOURFORK 2.1.x:auto-backport-of-pr-54881-on-2.1.x
  1. Create a PR against branch 2.1.x, I would have named this PR:

"Backport PR #54881 on branch 2.1.x (REGR: read_csv raising when dtypes is specified with usecols)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@phofl phofl deleted the 54868 branch September 1, 2023 11:14
phofl added a commit to phofl/pandas that referenced this pull request Sep 1, 2023
…dev#54881)

* REGR: read_csv raising when dtypes is specified with usecols

* Update

* Add whatsnew

(cherry picked from commit 75781c2)
phofl added a commit that referenced this pull request Sep 1, 2023
mroeschke pushed a commit to mroeschke/pandas that referenced this pull request Sep 11, 2023
…dev#54881)

* REGR: read_csv raising when dtypes is specified with usecols

* Update

* Add whatsnew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO CSV read_csv, to_csv Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

read_fwf: IndexError: list index out of range when using dtype and usecols parameters
2 participants