Since a few months I’ve been selling some Magic: the Gathering cards on CardMarket. Last week I realized I could extract the address from buyers from eml files (exported emails) with orders. From those the (approximate*) location using Google’s Geocoding API can be found and plotted using Altair. This gives a visual overview where my cards are ending up !

Hovering over the map shows summary stats for each country or location. The color coding can be changed dynamically with the combo-box below the chart. Locations close to each other are combined and shown with a larger dot, numbers inside the dots indicate how many orders were shipped to that municipality (or combination of municipalities).

As there are some cool bits of code used here (some GeoPandas, clustering on haversine distance, …) there will be a full-length blog post, outlining those tricks in the future!

(*) to ensure buyers’ addresses aren’t made public, the center of their municipality is used instead of the exact location.