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

feat(python): Add collect_schema method to LazyFrame and DataFrame #16929

Merged
merged 6 commits into from
Jun 14, 2024

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Jun 13, 2024

Ref #16328

Changes

  • Add collect_schema method to LazyFrame and DataFrame. This method is the same as the .schema property now. For LazyFrame, this is the idiomatic way to resolve the schema.
  • Update references to the LazyFrame properties .schema, .dtypes, .columns, and .width to use .collect_schema() instead.

This includes some performance improvements for methods that were abusing LazyFrame properties internally (LazyFrame.describe/fill_null). That convinces me this is a good move.

I did not yet add any warnings to the LazyFrame properties. This will be done separately.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Jun 13, 2024
@stinodego stinodego marked this pull request as ready for review June 13, 2024 13:22
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 86.84211% with 5 lines in your changes missing coverage. Please review.

Project coverage is 81.07%. Comparing base (8965a68) to head (5eb079d).
Report is 3 commits behind head on main.

Files Patch % Lines
py-polars/polars/lazyframe/frame.py 80.00% 1 Missing and 3 partials ⚠️
py-polars/polars/io/parquet/functions.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16929      +/-   ##
==========================================
- Coverage   81.10%   81.07%   -0.03%     
==========================================
  Files        1435     1435              
  Lines      189546   189553       +7     
  Branches     2712     2711       -1     
==========================================
- Hits       153732   153686      -46     
- Misses      35314    35367      +53     
  Partials      500      500              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stinodego stinodego marked this pull request as draft June 14, 2024 07:09
@stinodego stinodego marked this pull request as ready for review June 14, 2024 12:40
@stinodego stinodego merged commit 6a4641c into main Jun 14, 2024
23 checks passed
@stinodego stinodego deleted the collect-schema branch June 14, 2024 13:19
@c-peters c-peters added the accepted Ready for implementation label Jun 16, 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 enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants