Skip to content

BUG: Joining Pandas with Polars dataframe produces fuzzy errormessage #61434

Open
@Juan-132

Description

@Juan-132

Pandas version checks

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

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

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

See below.

Issue Description

Reproducible example

import pandas as pd

data = {
    "Column2": [10, 20, 30],
    "Column3": ["A", "B", "C"],
    "Column4": ["Lala", "YesYes", "NoNo"],
}
df1 = pd.DataFrame(data)
import polars as pl

data = {
    "Column1": ["Text1", "Text2", "Text3"],
    "Column2": [10, 20, 30],
    "Column3": ["A", "B", "C"]
}
df2 = pl.DataFrame(data)
result = df1.join(df2, on=["Column2", "Column3"], how="inner")

Log output

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_11612\367032622.py in ?()
----> 1 result = df1.join(df2, on=["Column2", "Column3"], how="inner")

c:\Users\name\AppData\Local\Programs\Python\Python312\Lib\site-packages\pandas\core\frame.py in ?(self, other, on, how, lsuffix, rsuffix, sort, validate)
  10766                 validate=validate,
  10767             )
  10768         else:
  10769             if on is not None:
> 10770                 raise ValueError(
  10771                     "Joining multiple DataFrames only supported for joining on index"
  10772                 )
  10773 

ValueError: Joining multiple DataFrames only supported for joining on index

Expected Behavior

Expected Result
Error message is not correct.
It should say that joining pandas dataframe with polars dataframe is not supported.

This is how Polars formulates the error when joining the other way around:
TypeError: expected other join table to be a DataFrame, not 'pandas.core.frame.DataFrame'

Installed Versions

INSTALLED VERSIONS

commit : 0691c5c
python : 3.12.9
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19045
machine : AMD64
processor : Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : Dutch_Netherlands.1252

pandas : 2.2.3
numpy : 2.2.5
pytz : 2025.2
dateutil : 2.9.0.post0
pip : 25.1.1
Cython : None
sphinx : None
IPython : 9.2.0
adbc-driver-postgresql: None
...
zstandard : None
tzdata : 2025.2
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugError ReportingIncorrect or improved errors from pandas

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions