Skip to content

Plotly Express cannot process wide-form data with columns of different type. #4266

@subsurfaceiodev

Description

@subsurfaceiodev

Hi! When running the following code:

df = pd.DataFrame({'numeric': [1, 2], 'string': ['A', 'B']})
fig = px.scatter(df, x=df.columns, facet_col='variable')
fig.show()

We get the following error:
ValueError: Plotly Express cannot process wide-form data with columns of different type.

Expected output is:
image

We understand the need for prevention of data type mixing for other type of plots, but for scatter or line plots use cases like expected output can be very common. Commenting the following code:

elif dtype != v_dtype:
    raise ValueError(
        "Plotly Express cannot process wide-form data with columns of different type."
    )

In plotly/express/_core.py gives us expected output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions