For Plotly Express, you need to use the custom_data argument when you create the figure. For example:
fig = px.scatter(
data_frame=df,
x='ColX',
y='ColY',
custom_data=['Col1', 'Col2', 'Col3']
)
and then modify it using update_traces and hovertemplate, referencing it as customdata. For example:
fig.update_traces(
hovertemplate="<br>".join([
"ColX: %{x}",
"ColY: %{y}",
"Col1: %{customdata[0]}",
"Col2: %{customdata[1]}",
"Col3: %{customdata[2]}",
])
)
This took a lot of trial and error to figure out, as it isn’t well-documented, and the inconsistency between the custom_data and customdata is confusing.