Skip to content

ENH: implement tm.shares_memory #44747

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 1 commit into from
Dec 4, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

xref #44152

Dedicated implementation based on https://github.com/pandas-dev/pandas/pull/43930/files#diff-6676eb1e10942179c11b3ef5a8a59d835a05873934580a52139117ebd1f2d7c3R236

@jreback jreback added this to the 1.4 milestone Dec 4, 2021
@jreback jreback added the Testing pandas testing functions or related to the test suite label Dec 4, 2021
@jreback jreback merged commit d6dbe6f into pandas-dev:master Dec 4, 2021
return shares_memory(left.sp_values, right)

if isinstance(left, ExtensionArray) and left.dtype == "string[pyarrow]":
# https://github.com/pandas-dev/pandas/pull/43930#discussion_r736862669
Copy link
Member Author

Choose a reason for hiding this comment

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

@jorisvandenbossche can you confirm that this is the right logic to use for ArrowStringArray?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but this will only be correct if both left and right only have a single chunk, which is not guaranteed to be the case (although probably will be the case in all tests where this is being used). Maybe adding an assert to guarantee this would be good

@jbrockmendel
Copy link
Member Author

Meant to implement tests before merging; will do so in follow-up(s)

@jbrockmendel jbrockmendel deleted the enh-shares_memory branch December 5, 2021 00:12
@twoertwein
Copy link
Member

I think this is causing mypy to complain on master:

pandas/_testing/__init__.py:1086: error: "ExtensionArray" has no attribute "_data"  [attr-defined]
pandas/_testing/__init__.py:1087: error: "ExtensionArray" has no attribute "_data"  [attr-defined]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants