-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
pl.concat on a series of series fails with: TypeError: 'Series' object cannot be converted to 'Sequence' #6656
Comments
You are passing a single pl.concat(
[
pl.Series([pl.Series([0, 1]), pl.Series([2, 3])])
]
) |
As Ritchie says, you are passing the wrong type into the function. You want one of the following:
|
@ritchie46 - thank you for a quick reply but what you propose does not achieve the goal here, which is to concatenate the inner series (which I probably should have clarified - my apologies). Both for
@alexander-beedie - thank you for your reply and the insight! This clarifies that series_of_series = pl.Series([pl.Series([0, 1]), pl.Series([2, 3])])
pl.concat([*series_of_series]) |
You can use |
Ah - right! Then my: pl.concat([*series_of_series]) is equivalent to: count = sum(map(lambda series: len(series), series_of_series))
series_of_series.reshape((1, count))[0]
I'm not sure how to take that path though :) |
Polars version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Issue description
It was observed that after the switch from 0.16.1 to 0.16.2, applying
pl.concat
to a series of series started to fail. Where previously it would yield a concatenated series it now fails with the following error:Searching through past issues pointed to two (somewhat) related threads:
val
ndarray object cannot be converted toSequence
PyO3/pyo3#2615 (linked to the one above)In case it is an expected behavior now - could you please advise on how to best (w.r.t. scalability) concatenate a series of series?
Thank you!
Reproducible example
Expected behavior
Installed versions
The text was updated successfully, but these errors were encountered: