pola-rs / polars

Dataframes powered by a multithreaded, vectorized query engine, written in Rust
https://docs.pola.rs
Other
26.63k stars 1.63k forks source link

converting pandas to Polars drops column if its name, when converted to string, matches another column's name #16025

Open MarcoGorelli opened 2 weeks ago

MarcoGorelli commented 2 weeks ago

Checks

Reproducible example

print(pl.from_pandas(pd.DataFrame({0: [1, 2], '0': [3, 4]}, dtype='Int64')))

Log output

shape: (2, 1)
┌─────┐
│ 0   │
│ --- │
│ i64 │
╞═════╡
│ 3   │
│ 4   │
└─────┘

Issue description

It silently drops one column

Expected behavior

I'd expect this to raise

Installed versions

``` --------Version info--------- Polars: 0.20.23 Index type: UInt32 Platform: Linux-5.15.146.1-microsoft-standard-WSL2-x86_64-with-glibc2.35 Python: 3.11.9 (main, Apr 6 2024, 17:59:24) [GCC 11.4.0] ----Optional dependencies---- adbc_driver_manager: cloudpickle: 3.0.0 connectorx: deltalake: fastexcel: fsspec: 2024.3.1 gevent: hvplot: 0.9.2 matplotlib: 3.8.4 nest_asyncio: 1.6.0 numpy: 1.26.4 openpyxl: pandas: 2.2.2 pyarrow: 15.0.2 pydantic: pyiceberg: pyxlsb: sqlalchemy: xlsx2csv: xlsxwriter: ```