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

Inconsistent behavior of pl.from_pandas(..., include_index=True) with pandas series #19399

Closed
2 tasks done
joankaradimov opened this issue Oct 23, 2024 · 2 comments
Closed
2 tasks done
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@joankaradimov
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

import pandas as pd
import polars as pl

df = pd.Series(data={'a': 1, 'b': 2, 'c': 3}, index=['a', 'b', 'c'])

# Both of these return a polars series with values 1, 2 ,3
pl.from_pandas(df)
pl.from_pandas(df, include_index=True)

Log output

No response

Issue description

Using include_index=True is useless when the data parameter of polars.from_pandas is a Series.

Expected behavior

Return a polars.DataFrame (with the index columns included) or fail with an exception to indicate that include_index=True is not applicable to pandas.Series

Installed versions

--------Version info---------
Polars:              1.10.0
Index type:          UInt32
Platform:            Linux-6.8.0-41-generic-x86_64-with-glibc2.36
Python:              3.9.19 (main, Sep  4 2024, 23:10:56) 
[GCC 12.2.0]
LTS CPU:             False

----Optional dependencies----
adbc_driver_manager  <not installed>
altair               4.2.2
cloudpickle          3.0.0
connectorx           <not installed>
deltalake            0.18.1
fastexcel            <not installed>
fsspec               2024.6.1
gevent               <not installed>
great_tables         <not installed>
matplotlib           3.8.4
nest_asyncio         1.6.0
numpy                1.23.5
openpyxl             <not installed>
pandas               1.1.3
pyarrow              16.0.0
pydantic             2.7.4
pyiceberg            <not installed>
sqlalchemy           <not installed>
torch                2.3.1+cu118
xlsx2csv             <not installed>
xlsxwriter           3.2.0
@joankaradimov joankaradimov added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Oct 23, 2024
@alexander-beedie
Copy link
Collaborator

Think this is a duplicate of #18859 🤔

@joankaradimov
Copy link
Author

joankaradimov commented Oct 23, 2024

Ah, sorry. I searched through the issues but didn't find this one. Definitely a duplicate.

@joankaradimov joankaradimov closed this as not planned Won't fix, can't repro, duplicate, stale Oct 23, 2024
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

2 participants