Skip to content

Plotly Express strange hover_data ValueError #1683

Closed
@suciokhan

Description

@suciokhan

Scatter plotting with no problems, until I attempted to map a column of my data to hover_data.
Here's what my data looks like. I'm trying to map the most_similar_kt column to hover_data.

image

Here's the error message:
ValueError: Element of value of 'hover_data' is not the name of a column in 'data_frame'. Expected one of ['x', 'y', 'label', 'freq', 'similarity', 'size', 'class', 'most_similar_kt'] but received: m

And here's my code:
fig = px.scatter(df, x='x',y='y', color='similarity', size='size', symbol='class',hover_name='label', hover_data='most_similar_kt', width=1500, height=1000, template='plotly_dark', render_mode='webgl')

Apologies if this has already been addressed; I spent 10 minutes googling for errors and it doesn't appear anyone else had this issue.

If I remove the hover_data assignment, then the plot works:
image

Thanks for your assistance!

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