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 Schema class #16873

Merged
merged 5 commits into from
Jun 13, 2024
Merged

feat(python): Add Schema class #16873

merged 5 commits into from
Jun 13, 2024

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Jun 11, 2024

Ref #16328

Changes

  • Introduce a new Schema class. It is currently basically just an OrderedDict, but has some additional methods:
    • names
    • dtypes
    • len
  • Update various schema methods to return this new Schema class instead of an OrderedDict.

Because it inherits OrderedDict, it can also be used as input for schema arguments anywhere in the API, e.g. the DataFrame constructor, read_csv, etc.

I will expand the Schema class in the future to be a bit more user friendly for direct use. For now it's already useful as a returned object from the upcoming LazyFrame.collect_schema method.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Jun 11, 2024
Copy link

codecov bot commented Jun 11, 2024

Codecov Report

Attention: Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.

Project coverage is 81.40%. Comparing base (47d19f3) to head (63a2cd0).

Files Patch % Lines
py-polars/polars/series/struct.py 40.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16873      +/-   ##
==========================================
- Coverage   81.41%   81.40%   -0.01%     
==========================================
  Files        1425     1426       +1     
  Lines      187964   187980      +16     
  Branches     2704     2704              
==========================================
+ Hits       153022   153024       +2     
- Misses      34445    34459      +14     
  Partials      497      497              

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

@stinodego stinodego marked this pull request as ready for review June 11, 2024 22:55
@ritchie46 ritchie46 merged commit 9a22c10 into main Jun 13, 2024
15 checks passed
@ritchie46 ritchie46 deleted the schema-class branch June 13, 2024 06:20
@c-peters c-peters added the accepted Ready for implementation label Jun 16, 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.

4 participants