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

DOC/TST: Document numpy 2.0 support and add tests for string array #58202

Merged
merged 1 commit into from Apr 10, 2024

Conversation

lithomas1
Copy link
Member

@lithomas1 lithomas1 commented Apr 9, 2024

@lithomas1 lithomas1 added Testing pandas testing functions or related to the test suite Docs Compat pandas objects compatability with Numpy or Python functions labels Apr 9, 2024
@lithomas1 lithomas1 added this to the 2.2.2 milestone Apr 9, 2024
@lithomas1 lithomas1 requested a review from mroeschke April 9, 2024 23:28
def test_np_string_array_object_cast(self, data):
from numpy.dtypes import StringDType

data["a"] = np.array(data["a"], dtype=StringDType())
Copy link
Member

Choose a reason for hiding this comment

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

Curious what happens when dtype=StringDType() is passed to pandas Series or DataFrame constructor? Fine if it doesn't work/converts to object but would be good to note if something unexpected happens

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it silently casts to object.

FWIW, I think the numpy fixed length strings also do this.

@lithomas1
Copy link
Member Author

/preview

Copy link
Contributor

Website preview of this PR available at: https://pandas.pydata.org/preview/pandas-dev/pandas/58202/

@lorentzenchr
Copy link

I don't know where to ask: Is there a ETA for pandas 2.2.2 with numpy 2.0(rc) support?

@lithomas1 lithomas1 merged commit 5232bee into pandas-dev:main Apr 10, 2024
55 of 56 checks passed
@lithomas1 lithomas1 deleted the stringarray-testing branch April 10, 2024 11:48
Copy link

lumberbot-app bot commented Apr 10, 2024

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.2.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 5232bee8df3b57766c44b62152aa3fdd24e40ada
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #58202: DOC/TST: Document numpy 2.0 support and add tests for string array'
  1. Push to a named branch:
git push YOURFORK 2.2.x:auto-backport-of-pr-58202-on-2.2.x
  1. Create a PR against branch 2.2.x, I would have named this PR:

"Backport PR #58202 on branch 2.2.x (DOC/TST: Document numpy 2.0 support and add tests for string array)"

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.

@lithomas1
Copy link
Member Author

I don't know where to ask: Is there a ETA for pandas 2.2.2 with numpy 2.0(rc) support?

Release is expected to happen today.

lithomas1 added a commit to lithomas1/pandas that referenced this pull request Apr 10, 2024
@lorentzenchr
Copy link

@lithomas1 Thanks for the prompt and quite pleasing response 😃

lithomas1 added a commit that referenced this pull request Apr 10, 2024
#58208)

Backport PR #58202: DOC/TST: Document numpy 2.0 support and add tests for string array
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions Docs Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

COMPAT/TST: Ensure that numpy 2 string dtype converts to object array in pandas 2.2.x
4 participants