question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plotly Express strange hover_data ValueError

See original GitHub issue

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!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
suciokhancommented, Jul 24, 2019

Apologies; I figure out that you are supposed to feed columns inside a list rather than just a string of the column name like the other items. Closing out.

6reactions
emmanuellecommented, Mar 5, 2020

@zhaomh1998 we have an open issue #2177 to improve the error message, it should be improved soon 😃.

Read more comments on GitHub >

github_iconTop Results From Across the Web

plotly express choropleth map customizing hover data error ...
plotly express choropleth map customizing hover data error: ValueError: Value of 'hover_data_0' is not the name of a column in 'data_frame'.
Read more >
plotly.graph_objects.Figure — 5.11.0 documentation
For area-like objects (bars, scatter fills, etc) hovering is on inside the area and off ... ValueError – if a property in the...
Read more >
plotly.express.scatter_matrix — 5.11.0 documentation
hover_name (str or int or Series or array-like) – Either a name of a column in data_frame , or a pandas Series or...
Read more >
plotly Changelog - PyUp.io
Type annotations for Plotly Express functions and chainable `go.Figure` methods, for better IDE ... Provide bbox of hover items in event data ......
Read more >
plotly.py | interactive graphing library for Python - kandi
plotly.py is a Python library typically used in Analytics, Data Visualization, Jupyter applications. ... Plotly express box plot hover data not working.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found