-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: ExtensionArrays disallow .values attribute #20794
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
TST: ExtensionArrays disallow .values attribute #20794
Conversation
This is a temporary "fix" to the interface. |
Ah, see you just did the same #20793 :-) |
Do you want to copy-paste my test here? https://github.com/pandas-dev/pandas/pull/20793/files#diff-fac89eff36e78c735bd1046e704780c9 I prefer your check. I was duck-typing on |
# Some aliases for common attribute names to ensure pandas supports | ||
# these | ||
self._items = self._data = self.data = self.values | ||
self._items = self.data = self._data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have .data here? (no a big deal, but this is private yes?) and I think you removed in liue of ._data)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just in the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you exactly mean? It's not really about private/public, that's up to the EA author. The purpose of this it to ensure pandas has no problems if an EA author would use .data
to store the underlying data (in geopandas we are actually using a data
attribute)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand you can have a .data
items, it just doesn't seem a good pattern to advertise
The fact that these are in the tests is very odd itself.
And the comment makes these doubly confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jorisvandenbossche ok I re-read what you are testing, this is ok
@@ -33,6 +33,13 @@ def __init__(self, values): | |||
raise TypeError | |||
self.data = values | |||
|
|||
# Some aliases for common attribute names to ensure pandas supports | |||
# these | |||
self._items = self._data = self.data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same?
which test do you mean? |
Codecov Report
@@ Coverage Diff @@
## master #20794 +/- ##
==========================================
- Coverage 91.85% 91.82% -0.03%
==========================================
Files 153 153
Lines 49308 49310 +2
==========================================
- Hits 45290 45280 -10
- Misses 4018 4030 +12
Continue to review full report at Codecov.
|
thanks! |
xref #20735.
Adds a test to ensure EA authors don't use the
.values
or._values
attribute, which can give problems with pandas internals depending on how the data is stored.