-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
refactor(python): Very minor refactor of DataFrame.to_numpy
code
#16325
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16325 +/- ##
==========================================
+ Coverage 81.35% 81.37% +0.01%
==========================================
Files 1403 1403
Lines 183707 183691 -16
Branches 2954 2954
==========================================
+ Hits 149460 149472 +12
+ Misses 33736 33708 -28
Partials 511 511 ☔ View full report in Codecov by Sentry. |
py-polars/polars/dataframe/frame.py
Outdated
@@ -1602,12 +1602,12 @@ def raise_on_copy(msg: str) -> None: | |||
|
|||
out = self._df.to_numpy(order) | |||
if out is None: | |||
return np.vstack( | |||
return np.column_stack( |
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 can recall I benchmarked this one. Why do we change from vstack
to column_stack
and what are the perf implications?
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.
Let me revert this one for now and look into it more closely - I haven't looked into this too deeply but there are some correctness implications, e.g. currently Array types are not handled correctly. It should not have been included in this PR.
Going to take a look at the dataframe code next, starting out with some small refactors.