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

Implement Series.get_chunks #5670

Closed
stinodego opened this issue Nov 29, 2022 · 0 comments · Fixed by #5701
Closed

Implement Series.get_chunks #5670

stinodego opened this issue Nov 29, 2022 · 0 comments · Fixed by #5701
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars

Comments

@stinodego
Copy link
Contributor

stinodego commented Nov 29, 2022

Problem description

Required for #5662

We need to be able to iterate over the chunks of a Series on the Python side. Example of desired functionality:

s1 = pl.Series([1,2])
s2 = pl.Series([3,4])

s = pl.concat([s1, s2], rechunk=False)
s.num_chunks()  # returns 2

for c in s.get_chunks():  # iterate over chunks
    print(c)  # prints `s1` then `s2`

# shape: (2,)
# Series: '' [i64]
# [
#         1
#         2
# ]
# shape: (2,)
# Series: '' [i64]
# [
#         3
#         4
# ]

Series.get_chunks should return an Iterable[Series]

Actually we'd want the same functionality for iterating over de chunks of a DataFrame, but we can probably infer this from the Series chunks.

@stinodego stinodego added python Related to Python Polars enhancement New feature or an improvement of an existing feature labels Nov 29, 2022
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 a pull request may close this issue.

1 participant