Okay, so I’m gonna walk you through this little project I did – mapping all the MLB ballparks. It was a fun one, got to mess around with some data and make something kinda cool.

First off, I needed data, right? I started by scouring the internet for a list of MLB stadiums. Ended up finding a decent Wikipedia page with all the names and locations. Pretty standard stuff.
Next, the locations from wikipedia was just city and state. I needed coordinates, latitude and longitude. So, I threw those city/state combos into a geocoding service (used a free one, nothing fancy). This gave me the lat/long for each ballpark. It took some time to do, but I slowly copy and pasted all the locations into the tool and got the coordinates and saved them into a file, a simple CSV will do.
Now, I had my data! Time to actually, you know, make a map. I decided to use Python with a library called Folium. It’s pretty straightforward for creating interactive maps.
I fired up my Jupyter Notebook and started coding. First, I imported the necessary libraries: Folium and Pandas (for reading the CSV data).
Then, I read my CSV file with the ballpark names and coordinates into a Pandas DataFrame. This made it easy to access the data.

Next, I created a Folium map object. I centered the map on the US, zoomed out a bit so you could see everything.
Here’s where the fun started: looping through the DataFrame and adding markers for each ballpark. For each row in the DataFrame, I grabbed the latitude, longitude, and ballpark name. Then, I created a Folium Marker object with the coordinates and a popup showing the ballpark name. Added that marker to the map.
To make it a bit nicer, I added some tooltips. It displays the name of the stadium when you hover over the marker.
Finally, I saved the Folium map to an HTML file. This way, I could easily open it in a browser and see the interactive map.
And that’s pretty much it! I ended up with a cool, interactive map of all the MLB ballparks. You can zoom in, zoom out, hover over the markers to see the ballpark names. It was a good little project, and I learned a bit about Folium in the process.

Lessons Learned
- Geocoding can be a bit of a pain, especially if you’re doing it manually. There are APIs for that, but for this small project, copy-pasting did the trick.
- Folium is a pretty awesome library for creating interactive maps. Super easy to use, and you can do a lot with it.
- Data cleaning is always important. Make sure your data is consistent and accurate before you start mapping it.