Skip to content

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

Merged
merged 50 commits into from
Mar 26, 2020
Merged

CLN: .values -> ._values #32778

merged 50 commits into from
Mar 26, 2020

Conversation

jbrockmendel
Copy link
Member

No description provided.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a 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).

@jbrockmendel
Copy link
Member Author

what logic do we we use to decide when to use which property?

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.

@jreback
Copy link
Contributor

jreback commented Mar 19, 2020

comments here: #32781 (comment)

@jbrockmendel
Copy link
Member Author

Travis yellow is wrong; travis is green

@jreback jreback added this to the 1.1 milestone Mar 26, 2020
@jreback jreback merged commit 3415832 into pandas-dev:master Mar 26, 2020
@jreback
Copy link
Contributor

jreback commented Mar 26, 2020

kk, no test covers this?

@jbrockmendel
Copy link
Member Author

no test covers this?

not sure what you're referring to

@jbrockmendel jbrockmendel deleted the no-values branch March 26, 2020 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants