Show code
import pandas as pd
import numpy as np
import folium
= pd.read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2025/2025-07-22/mta_art.csv')
mta_art = pd.read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2025/2025-07-22/station_lines.csv')
station_lines
# Extra to get the Long and LAt of NY MTA
= pd.read_csv("https://data.ny.gov/resource/39hk-dx4f.csv?$query=SELECT%20gtfs_stop_id%2C%20station_id%2C%20complex_id%2C%20division%2C%20line%2C%20stop_name%2C%20borough%2C%20cbd%2C%20daytime_routes%2C%20structure%2C%20gtfs_latitude%2C%20gtfs_longitude%2C%20north_direction_label%2C%20south_direction_label%2C%20ada%2C%20ada_northbound%2C%20ada_southbound%2C%20ada_notes%2C%20georeference")
station_locations
= station_locations[["stop_name", "gtfs_longitude", "gtfs_latitude"]]
station_locations = station_locations.rename(columns={"stop_name": "station_name", "gtfs_longitude": "longitude", "gtfs_latitude": "latitude"})
station_locations
= mta_art.merge(station_locations, on="station_name", how="left")
master
= master['latitude'].mean()
center_lat = master['longitude'].mean()
center_lon
= folium.Map(location=[center_lat, center_lon], zoom_start=12)
m
for _, row in master.iterrows():
= row['latitude']
lat = row['longitude']
lon = row['station_name']
station = row.get('art_title', 'No artwork info')
artwork = row.get('art_image_link', None)
art_link
if pd.notnull(lat) and pd.notnull(lon):
if pd.notnull(art_link):
= f'<a href="{art_link}" target="_blank">View Artwork</a>'
link_html else:
= "No image link available"
link_html
= folium.Popup(
popup_html f"""
<b>Station:</b> {station}<br>
<b>Artwork:</b> {artwork}<br>
<b>Link:</b> {link_html}
""",
=300
max_width
)
folium.Marker(=[lat, lon],
location=f"Station: {station}\nArtwork: {artwork}", # simpler tooltip for hover
tooltip=popup_html,
popup=folium.Icon(color='blue', icon='info-sign')
icon
).add_to(m)
m
Make this Notebook Trusted to load map: File -> Trust Notebook