-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: Use to_numpy directly in cov / corr #34031
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
Conversation
Otherwise this can raise for an all integer DataFrame without any missing values
Co-authored-by: Joris Van den Bossche <[email protected]>
Co-authored-by: Joris Van den Bossche <[email protected]>
Co-authored-by: Joris Van den Bossche <[email protected]>
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.
lgtm @jreback
pandas/core/frame.py
Outdated
@@ -7973,7 +7973,7 @@ def corr(self, method="pearson", min_periods=1) -> "DataFrame": | |||
numeric_df = self._get_numeric_data() | |||
cols = numeric_df.columns | |||
idx = cols.copy() | |||
mat = numeric_df.astype(float, copy=False).to_numpy() | |||
mat = numeric_df.to_numpy(dtype=float, na_value=np.nan) |
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.
do we have copy=False by default in .to_numpy()
?
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.
Yes but I can make this explicit
No description provided.