-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: .values -> ._values #32778
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
CLN: .values -> ._values #32778
Conversation
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.
Similar general question as in #32781: what logic do we we use to decide when to use which property?
Just always _values
when possible (to ensure we always are using the correct representation, ndarray or EA)? Or do we still prefer to use the public attribute where it's not different from _values
?
Also, in the latter case, that's typically because we are either sure the result is always numpy array (in which case np.asarray()
or to_numpy
might be more explicit) or always an ExtensionArray (in which case .array
might be more idiomatic).
The default should be ._values, as .values may be either lossy (dt64tz), involve an object-dtype cast (period, interval), or be surprising (until recently I forgot that Series[Sparse].values gives a SparseArray, not ndarray). Both this and #32781 are aimed at usages where the two are equivalent. This should make it easier to focus attention on usages where they are not equivalent, and double-check whether those are intentional or improveable. |
comments here: #32781 (comment) |
Travis yellow is wrong; travis is green |
kk, no test covers this? |
not sure what you're referring to |
No description provided.