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

List(string) cannot be coerced with String anymore since 1.0 in Concat #17347

Closed
2 tasks done
ion-elgreco opened this issue Jul 2, 2024 · 2 comments
Closed
2 tasks done
Labels
bug Something isn't working python Related to Python Polars

Comments

@ion-elgreco
Copy link
Contributor

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

Before v1.0 (on 0.20.10)

df_a = pl.DataFrame({
    "foo":['a','b','c']
})
df_b = pl.DataFrame({
    "foo":[['a'],['b','d'],['c']]
})

pl.concat(
    [df_a, df_b],
    how="diagonal_relaxed",
)

shape: (6, 1)
┌────────────┐
│ foo        │
│ ---        │
│ list[str]  │
╞════════════╡
│ ["a"]      │
│ ["b"]      │
│ ["c"]      │
│ ["a"]      │
│ ["b", "d"] │
│ ["c"]      │
└────────────┘

After v1.0 we get this:

InvalidOperationError: cannot cast List type (inner: 'String', to: 'String')

Log output

No response

Issue description

Before you could coerce string and list[string] to list[string], but since v1.0 this is not possible anymore. @stinodego

Expected behavior

Be able to coerce list[string] and string.

Installed versions

--------Version info---------
Polars:               1.0.0
Index type:           UInt32
Platform:             Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.39
Python:               3.10.12 (main, Jun 28 2024, 11:13:01) [GCC 13.2.0]

----Optional dependencies----
adbc_driver_manager:  <not installed>
cloudpickle:          3.0.0
connectorx:           <not installed>
deltalake:            0.18.0
fastexcel:            0.10.4
fsspec:               2024.2.0
gevent:               <not installed>
great_tables:         <not installed>
hvplot:               <not installed>
matplotlib:           <not installed>
nest_asyncio:         1.6.0
numpy:                1.26.4
openpyxl:             3.1.5
pandas:               1.5.3
pyarrow:              16.1.0
pydantic:             2.7.4
pyiceberg:            <not installed>
sqlalchemy:           2.0.31
torch:                2.2.2+cpu
xlsx2csv:             0.8.2
xlsxwriter:           3.2.0
@ion-elgreco ion-elgreco added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jul 2, 2024
@ion-elgreco ion-elgreco changed the title List(string) cannot be coerced with String anymore since 1.0 List(string) cannot be coerced with String anymore since 1.0 in Concat Jul 2, 2024
@stinodego
Copy link
Contributor

stinodego commented Jul 2, 2024

Thanks for the report. This is intentional, see #16918

I will add an example to make this clear.

@stinodego stinodego closed this as not planned Won't fix, can't repro, duplicate, stale Jul 2, 2024
@stinodego stinodego removed the needs triage Awaiting prioritization by a maintainer label Jul 2, 2024
@ion-elgreco
Copy link
Contributor Author

@stinodego ah that's a shame, I really liked how it behaved before :)

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

2 participants