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): Streamline creation of empty frame from Schema #20267

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Dec 12, 2024

Closes #20262.

Simple, but useful...

Example

import polars as pl

s = pl.Schema({"x": pl.Int32(), "y": pl.String()})
s.empty_frame()
# shape: (0, 2)
# ┌─────┬─────┐
# │ x   ┆ y   │
# │ --- ┆ --- │
# │ i32 ┆ str │
# ╞═════╪═════╡
# └─────┴─────┘

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

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.65%. Comparing base (0edbfff) to head (3edcdfb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20267      +/-   ##
==========================================
- Coverage   79.65%   79.65%   -0.01%     
==========================================
  Files        1565     1565              
  Lines      218283   218286       +3     
  Branches     2475     2475              
==========================================
- Hits       173877   173873       -4     
- Misses      43839    43846       +7     
  Partials      567      567              

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

@ritchie46
Copy link
Member

We already have to_frame for Series, shall we use the same name here.

And docs entries. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add empty_data_frame function to pl.Schema
2 participants