Get startedGet started for free

Adding markers for the public art

Now that you have added the polygon for the Urban Residents neighborhood to your folium street map, it's time to add the locations of the art within the neighborhood. You can do that by creating folium markers. Each marker needs a location assigned. Use iterrows() to loop through the data to grab the values you need.

This exercise is part of the course

Visualizing Geospatial Data in Python

View Course

Exercise instructions

  • First take a look at the tuple returned by iterrows() by printing the first and second values.
  • Assign the second value of the iterrows() tuple to row_values. Create a location formatted for folium, use it to build a marker, and add it to the downtown_map.
  • Display the map.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Iterate through the urban_art and print each part of tuple returned
for row in urban_art.iterrows():
  print('first part: ', row[____])
  print('second part: ', row[____])

# Create a location and marker with each iteration for the downtown_map
for row in urban_art.iterrows():
    row_values = row[1] 
    location = [row_values[____], row_values[____]]
    marker = folium.Marker(location = ____)
    marker.____(downtown_map)

# Display the map
display(____)
Edit and Run Code