I'm not able to see my data on the map when I run the following script. I can see the map, the temporal slider is present at the bottom and scrolls through the dates I provided, however, I do not see a heat signature at any of the locations. Is there something I'm leaving off of this?
This is the table I'm working with:
# HEATMAP OVER TIME WITH MY DATA
import folium
from folium import plugins
import pandas as pd
ASOS_DATA = r"C:\Users\ASOS_Cali_Weather_Stations.csv"
df = pd.read_csv(ASOS_DATA)
latlon = (df[["lon", "lat"]]).values.tolist()
date = (df["test_date"]).values.tolist()
# MAP
map_heatmap_time = folium.Map([37, -122], tiles='CartoDB Dark_Matter', zoom_start = 6)
# HEATMAP PLUGIN
heatmap_time_plugin = plugins.HeatMapWithTime(latlon, index= date)
# ADD HEATMAP PLUGIN TO MAP
heatmap_time_plugin.add_to(map_heatmap_time)
# DISPLAY THE MAP
map_heatmap_time
This seems to do the trick. Combined some code snippets from the following 2 links (https://www.youtube.com/watch?v=t9Ed5QyO7qY and https://blog.jovian.ai/interesting-heatmaps-using-python-folium-ee41b118a996#154e)
import folium
from folium import plugins
import pandas as pd
ASOS_DATA = r"C:\Users\ASOS_Cali_Weather_Stations.xlsx"
df = pd.read_excel(ASOS_DATA)
time_index= list(df["test_date"].sort_values().astype('str').unique())
df["test_date"] = df["test_date"].sort_values(ascending=True)
data = []
for _, d in df.groupby("test_date"):
data.append([[row['lat'], row["lon"], row["norm_temp"]] for _,row in d.iterrows()])
map_heatmap_time = folium.Map([37, -122], tiles='CartoDB Dark_Matter', zoom_start = 7)
heatmap_time_plugin = plugins.HeatMapWithTime(data, index= time_index)
heatmap_time_plugin.add_to(map_heatmap_time)
map_heatmap_time