How Web Scraping is Used to Explore Indian Restaurants in Canada?

November 25, 2021

This blog is the result of working on a real dataset that works as a part of the IBM data science professional program Capstone project and gaining a feel of what scientists think in their life. The main goals of this project were to create a business problem, search the web for data, and evaluate several districts in Toronto using Foursquare location data to determine which neighborhood is best for starting a new food business. We will use step-by-step strategies to get the desired objectives in this project.

Problem Description

Consider the case of an individual who wishes to launch a new Indian restaurant. And the individual is Indo-Canadian and resides in Toronto, Canada's most populous city. As a result, he is unsure whether or not opening a restaurant is a wise idea. And if it's a good idea for him to open his new restaurant in which neighborhood, for it to be profitable.


This project will assist a diverse range of individuals.

  • Entrepreneur who wishes to open a new restaurant in the area.
  • Indians who desire to relocate to areas with an abundance of Indian eateries and culture.
  • A data analyst or data scientist who uses statistical and exploratory data analysis to analyze the neighborhood.

Data Acquisition

There are various sources from which the data can be collected and used for different purposes:

1. List of postal codes from Canada

Here is the list of postal codes of the neighborhoods in Canada from Wikipedia.



2. Geographical Co-ordinates

Here shown is the CSV file that consists of the Latitude and Longitude of the neighborhoods in Canada.

Link for CVS:


3. Fetching Details of the Venue

Here we will use Foursquare API for extracting the details and location of the venue. Here, the venue is used as a threshold and finally, we will use Folium. From Foursquares API


You will fetch the following for every venue:

  • Name: Venue name
  • Category: The type of the category defined by the API.
  • Latitude: The Latitude value of the venue
  • Longitude: The Longitude value of the venue.
  • Likes: Likes of the venue, which the user liked
  • Rating: Rating of the venue
  • Tips: Tips provided by the users.

Curious to explore restaurant data?

Ideas Flow

Data Cleaning

Cleaning the Postal Code Data

There will be three columns in the data frame: Postal Code, Borough, and Neighborhood.

Only the cells with a borough assigned are processed. Ignore cells that have an unassigned borough.

In a single postal code location, more than one neighborhood may exist. For example, M5A is listed twice in the table on the Wikipedia page, and it contains two neighborhoods: Harbourfront and Regent Park. As seen in row 11 of the preceding table, these two rows will be consolidated into one row, with the neighborhoods separated by a comma.

When a cell has a borough but no neighborhood specified, the neighborhood is the same as the borough.


Adding Geographical Co-ordinates

For this we will use a CVS file that will consist of the latitude and longitude of the neighborhoods in Canada.

Link for CSV:


We will now only work with boroughs that are part of Toronto.


Indian Restaurants in Toronto

Fetching all the Indian Restaurants in the Toronto


Exploratory Analysis

Let us analyze the number of Indian Restaurants present in each Borough


Let us also scrape the Indian restaurants present in each neighborhood


Get Ratings, Likes and Tips of the Restaurants using Foursquare API

Extracting the ratings, likes, tips of the restaurants using Foursquare API


The Average Ratings

Getting the average rating of the restaurants in a specific neighborhood


Here we will have the extracted list of the top Indian restaurants.

Looking to explore Indian Restaurants in Canada?

Contact Foodspark today and request a quote!!

Get in touch

We will catch you as early as we receive the message

We hate spam, and we respect your privacy.

What Our Clients Say About Foodspark

Over 1000+ Satisfied Clients and Still Growing

Read More Reviews

review review review