Skip to content
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

Merged
merged 3 commits into from
May 20, 2024

Conversation

stinodego
Copy link
Member

Going to take a look at the dataframe code next, starting out with some small refactors.

@github-actions github-actions bot added internal An internal refactor or improvement python Related to Python Polars labels May 20, 2024
Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.37%. Comparing base (f5c32f2) to head (cdcd2ee).

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.
📢 Have feedback on the report? Share it here.

@@ -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(
Copy link
Member

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?

Copy link
Member Author

@stinodego stinodego May 20, 2024

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.

py-polars/src/to_numpy.rs Show resolved Hide resolved
@ritchie46 ritchie46 merged commit ec904e6 into main May 20, 2024
17 checks passed
@ritchie46 ritchie46 deleted the df-to-np-fixes branch May 20, 2024 09:34
@c-peters c-peters added the accepted Ready for implementation label May 21, 2024
Wouittone pushed a commit to Wouittone/polars that referenced this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation internal An internal refactor or improvement python Related to Python Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants