Skip to content

Incorrect interpretation of nullable data types #3495

Description

@sergiykhan

Description

Using Pandas' nullable data types (Int64 and Float64) result in an incorrect plot.

Code

import pandas as pd
import plotly.express as px
df = pd.DataFrame(
    data=[1,2,3,4,5],
    columns=['a'],
    index=pd.date_range('2021-01-01', '2021-01-05'),
    dtype='Int64',
)

px.bar(df)

Result

wrong

Expected

correct

Activity

  1. avm19 commented on Jan 16, 2024

    @avm19

    Cannot reproduce in plotly '5.16.1', must've been fixed in or before this version.

  2. sergiykhan commented on Jan 16, 2024

    @sergiykhan
    Author

    I have plotly 5.18.0 installed right now, and the problem is still there.

  3. avm19 commented on Jan 16, 2024

    @avm19

    I have plotly 5.18.0 installed right now, and the problem is still there.

    I tried in plotly version 5.18.0, but to no avail. Maybe it depends on other packages in a tricky way.

    import pandas as pd
    import plotly.express as px
    import plotly
    df = pd.DataFrame(
        data=[1,2,3,4,5],
        columns=['a'],
        index=pd.date_range('2021-01-01', '2021-01-05'),
        dtype='Int64'
    )
    
    px.bar(df, height=300, title=plotly.__version__ + '; ' + pd.__version__)

    newplot

  4. sergiykhan commented on Jan 16, 2024

    @sergiykhan
    Author

    Ah, I am still running Pandas 1.5.3 (due to bugs in 2.x related to timestamp resolution). So, I suppose some issues related to nullable types got fixed in Pandas 2.x.

    1
    2

  5. gvwilson commented on Jul 11, 2024

    @gvwilson
    Contributor

    Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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