1

I am trying to create a heatmap using pydeck. The DataFrame where the necessary data is derived from (loc_df) has the following columns:

>>> loc_df.columns
Index(['Firm', 'Relationship', 'lon', 'lat'], dtype='object')

and I am creating the heatmap as follows:

import pydeck as pdk

density = pdk.Layer(
    "HeatmapLayer",
    data=loc_df,
    opacity=0.9,
    get_position=["lon", "lat"],
    aggregation=pdk.types.String("MEAN"),
    auto_highlight=True,
    threshold=1,
    pickable=True,
)

TOOLTIP_TEXT = {"html": "Firm: {Firm} <br />Relationship: {Relationship}"}

deck = pdk.Deck(layers=[density], tooltip=TOOLTIP_TEXT)

deck.to_html('test_map.html')

and yet, when I view the map, the tooltips aren't being formatted correctly.

I've used the exact same code for other types of layers offered by pydeck and it works fine. But when I do the same for a heatmap layer, this error occurs.

Does Heatmap simply not allow this type of tooltip formatting, or is something else going wrong here?

Thanks in advance for any help.

0 Answers0