Which Tim Hortons Did Santa Go: Interactive visualization of Latitude and Longitude on Maps With Plotly and Python

An easy way to create interactive geographical scatter plots

All Images in the Article Created by Author

Which Tim Hortons is the one Santa Claus usually visits?

Import libraries:

Load the dataset:

Keep only the columns we need in this project:

Check if there are missing values:

Plot all stores on a world map:

import plotly.express as pxfig = px.scatter_geo(df,lat=df.latitude,lon=df.longitude,hover_name="_id",scope='world')fig.show()# Save the image
fig.write_image("./TimHortonsOnWorldMap.png", width=1200, height=800)

Clean the data:

There are two dots far away from others. Let’s take a closer look.

A quick EDA:

Statistic summary:

A ‘fancy’ Plot with go.Scattergeo

Here we create another plot to show how to use go.Scattergeo from plotly.graph_objects

Check the northernmost Tim Hortons:

photo by author

Data Scientist: Keep it simple.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store