I am trying to get the pop-up box in Gmaps to show information from two different lists. When I use 'and' to combine my info_box_content only unemployment rate show in the pop-up. When I comment out the second list (as shown) the poverty rate info shows. Is this possible?
poverty_rate = census_data["Poverty Rate"].tolist()
unemployment_rate = census_data["Unemployment Rate"].tolist()
marker_locations = census_data[['Latitude', 'Longitude']]
fig = gmaps.figure()
markers = gmaps.marker_layer(marker_locations,
info_box_content=[f"Poverty Rate: {rate}" for rate in poverty_rate]) #and [f"Unemployment Rate:
{un_rate}" for un_rate in unemployment_rate
fig.add_layer(markers)
fig
The info_box parameter takes a list with a string for each marker. You can create that string however you want. For instance, you could write:
info_box_content = [
f"Poverty Rate: {poverty_rate_value}, Unemployment rate: {unemployment_rate_value}"
for poverty_rate_value, unemployment_rate_value
in zip(poverty_rate, unemployment_rate
]
markers = gmaps.marker_layer(marker_locations, info_box_content)
Note that you can use arbitrary HTML in the template, so you can format your string nicely. See the tutorial on markers for examples.