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

polars.DataFrame.to_arrow() unnecessarily sets string columns as large_string type #15589

Closed
2 tasks done
Sara-ShiHo opened this issue Apr 10, 2024 · 1 comment
Closed
2 tasks done
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@Sara-ShiHo
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

df = pl.DataFrame(
    {"foo": [1, 2, 3, 4, 5, 6], "bar": ["a", "b", "c", "d", "e", "f"]}
)
df.to_arrow()

Log output

No response

Issue description

.to_arrow() sets string columns to large_string regardless of data size.

Expected behavior

pandas actually does this correctly.

df = pl.DataFrame(
    {"foo": [1, 2, 3, 4, 5, 6], "bar": ["a", "b", "c", "d", "e", "f"]}
)  # polars
df = df.to_pandas()  # pandas
pa.Table.from_pandas(df)

this results in

pyarrow.Table
foo: int64
bar: string

Installed versions

0.20.19
@Sara-ShiHo Sara-ShiHo added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Apr 10, 2024
@Sara-ShiHo
Copy link
Author

this is a duplicate #15047

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

No branches or pull requests

1 participant