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

BUG: reset_index not preserving object dtype for string option #56160

Merged
merged 4 commits into from Dec 7, 2023

Conversation

phofl
Copy link
Member

@phofl phofl commented Nov 24, 2023

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@phofl phofl added this to the 2.1.4 milestone Nov 24, 2023
@phofl phofl added Strings String extension data type and string data Arrow pyarrow functionality labels Nov 24, 2023
@@ -163,6 +163,12 @@ def test_reset_index_inplace_and_drop_ignore_name(self):
expected = Series(range(2), name="old")
tm.assert_series_equal(ser, expected)

def test_reset_index_drop_infer_string(self):
# GH#56160
ser = Series(["a", "b", "c"], dtype=object)
Copy link
Member

Choose a reason for hiding this comment

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

This test doesn't need to involve the infer_string option?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yikes, added It, thx

@lithomas1
Copy link
Member

pre-commit.ci autofix

Copy link
Member

@lithomas1 lithomas1 left a comment

Choose a reason for hiding this comment

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

This LGTM on green.

@lithomas1 lithomas1 merged commit 5e0df27 into pandas-dev:main Dec 7, 2023
44 checks passed
@lithomas1
Copy link
Member

thanks @phofl

Copy link

lumberbot-app bot commented Dec 7, 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 5e0df27fadfeb29e76336b527f4c01cd2f575136
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #56160: BUG: reset_index not preserving object dtype for string option'
  1. Push to a named branch:
git push YOURFORK 2.1.x:auto-backport-of-pr-56160-on-2.1.x
  1. Create a PR against branch 2.1.x, I would have named this PR:

"Backport PR #56160 on branch 2.1.x (BUG: reset_index not preserving object dtype for string option)"

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 reset_index branch December 7, 2023 21:35
phofl added a commit to phofl/pandas that referenced this pull request Dec 7, 2023
…s-dev#56160)

* BUG: reset_index not preserving object dtype for string option

* Fixup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Thomas Li <47963215+lithomas1@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

(cherry picked from commit 5e0df27)
phofl added a commit that referenced this pull request Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality Strings String extension data type and string data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants