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

.implode() returns list(list()) instead of list() #10042

Closed
2 tasks done
pastastical opened this issue Jul 23, 2023 · 2 comments
Closed
2 tasks done

.implode() returns list(list()) instead of list() #10042

pastastical opened this issue Jul 23, 2023 · 2 comments
Labels
bug Something isn't working python Related to Python Polars

Comments

@pastastical
Copy link

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

data = {"a":[1,1,1], "b":[2,3,4] }
pl.DataFrame(data).groupby("a").agg(
    pl.col("b").implode()
)
shape: (1, 2)
a b
i64 list[list[i64]]
1 [[2, 3, 4]]

Issue description

When aggregating a group column using .implode(), the result is a column of type list(list()) instead of list().

Expected behavior

data = {"a":[1,1,1], "b":[2,3,4] }
pl.DataFrame(data).groupby("a").agg(
    pl.col("b").implode()
)
shape: (1, 2)
a b
i64 list[i64]
1 [2, 3, 4]

Installed versions

--------Version info---------
Polars:              0.18.8
Index type:          UInt32
Platform:            Windows-10-10.0.22621-SP0
Python:              3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]

----Optional dependencies----
adbc_driver_sqlite:  <not installed>
cloudpickle:         <not installed>
connectorx:          <not installed>
deltalake:           0.9.0
fsspec:              <not installed>
matplotlib:          3.7.1
numpy:               1.24.3
pandas:              2.0.1
pyarrow:             12.0.0
pydantic:            <not installed>
sqlalchemy:          <not installed>
xlsx2csv:            <not installed>
xlsxwriter:          <not installed>```

</details>
@pastastical pastastical added bug Something isn't working python Related to Python Polars labels Jul 23, 2023
@cmdlineluser
Copy link
Contributor

You can just remove the .implode() - #6487

@ritchie46
Copy link
Member

This is expected as @cmdlineluser refers to in #6487

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Related to Python Polars
Projects
None yet
Development

No branches or pull requests

3 participants