The Battle of Neighborhoods: Where Should Toronto's Next Coffee Shop Go?

This project set out to answer a very practical question: if you were opening a new coffee shop in the City of Toronto, where should it go? It is a nice example of how a location decision that people usually make on gut feel can be approached with data, pulling in postal code and borough data, exploring what is actually around each neighbourhood and letting clustering surface the areas that look most promising.

Building the neighbourhood dataset

I started by scraping the list of Toronto postal codes, boroughs, and neighbourhoods from Wikipedia, then merged in geographical coordinates (latitude and longitude) for each postal code. After dropping unassigned boroughs, this left a clean dataset covering the boroughs and neighbourhoods of Toronto, ready to plot and explore.

Exploring what's already there

Using the Foursquare API, I pulled nearby venues for every neighbourhood: cafés, restaurants, shops, gyms, parks, and everything else within a 500m radius. This gave a picture of how busy or venue-dense each neighbourhood already was.

Bar chart of neighbourhoods in Toronto with more than 45 venues
Neighbourhoods in Toronto with more than 45 venues returned by Foursquare.

From there, I isolated coffee shops specifically. Toronto has 184 coffee shops spread across 47 neighbourhoods and 9 boroughs, but they are far from evenly distributed. Some neighbourhoods are saturated with coffee shops relative to their overall venue count; others have almost none despite plenty of foot traffic potential.

Stacked bar chart comparing coffee shop count to total venues per neighbourhood
Neighbourhoods with 5 or more coffee shops, compared against total venue count.

Clustering the neighbourhoods

To group similar neighbourhoods together based on the mix of venues around them, I one-hot encoded venue categories and ran k-means clustering. The elbow method suggested 2 clusters was mathematically optimal, but I used 5 instead, which i consider a reasonable trade-off, since 2 clusters would have been too coarse to say anything useful about individual neighbourhoods.

Elbow method plot for choosing optimal number of clusters
Elbow method plot used to select the number of clusters (k).

Each of the 5 clusters captured a different neighbourhood "type" based on its most common venues: some centred around nightlife and restaurants, others around parks and residential amenities, and a couple with the exact mix that tends to support a successful coffee shop: businesses, schools, universities, public transport and steady foot traffic.

What to look for

Businesses, kindergartens, schools, universities, business districts, public transportation and consistent foot traffic, alongside adjacent categories like smoothie joints, juice bars, bagel shops, and fast-food chains, which act as useful proxies for the same kind of demand.

Picking the best cluster

Clusters 1 and 2 stood out as the strongest candidates. Both had a healthy mix of businesses, offices, universities, and other venues associated with reliable foot traffic. Cluster 1 was ultimately the more compelling choice: even though coffee shops were already common there, the cluster was large and diverse, with plenty of schools, parks and transit connections to support sustained demand rather than direct saturation.

Using Toronto City Hall as a central reference point, I pulled the coffee shops sitting specifically within Cluster 1's neighbourhoods. Timothy's World Coffee was the leading chain there with 8 outlets, followed by Balzac's Coffee with 3.


Recommendation

Comparing coffee shop counts against total venues per neighbourhood highlighted two standout areas: Garden District Ryerson and Central Bay Street. Central Bay Street already has a fairly healthy coffee shop presence with 11 out of 60 total venues, 8 of which sit in Cluster 1. Garden District Ryerson, on the other hand, has only 9 coffee shops out of 100 total venues, with just 4 in Cluster 1, meaning demand-supporting venues are dense, but coffee shop supply hasn't caught up.

Garden District Ryerson came out as the strongest recommendation: plenty of businesses, a university, parks, and reliable transit links, but comparatively few coffee shops relative to that level of activity. A next step for a real client would be to dig into competitor reviews and user tips via Foursquare to understand what existing coffee shops in the area are (and are not) offering.


The full notebook: data collection, cleaning, clustering, and the venue analysis in more detail, is available on GitHub.