INTRODUCTION: Gourmet Bussines


A chef has contacted me, since he needs to do a study of the businesses that have been successful in the culinary field he develops.

With respect to his experience, he has been based on Gourmet businesses in certain areas of Mexico City where they have been well received by the population.

His intention is to open a gourmet-type business in a potential place for his success and where the concept has not yet arrived.

The proposal that he makes to me is the following:

Customer's proposal


Dear Minerva: I am in contact with you to formally make my intention to require your artificial intelligence / machine learning service, for which I will detail below the requirements of the project you will develop.


As part of a professional growth, I intend to open a gourmet store, which will have as main selling axes:

Butchery: National and imported cuts of beef (prime quality) will be sold, wagyu meat (imported from Japan), aged meat (inside the store by us in aging chambers), pork cuts, piglets, exotic meats such as wild boar, crocodile. Fish and seafood: Daily selection attached to sustainable fishing, fish and shellfish national and imported. Spices, fruits, vegetables and other items related to gourmet preparations. Workshops, courses.


As part of the support I require from you, I need to determine the ideal location of the store, which could be in the Cuahutemoc or Benito Juarez delegation, for which I need to consider the following points in order to make a decision:

Purchase incidence: Take into account the purchasing trends of customers, according to nearby businesses. Opening hours and closing of the store. Market segmentation.

Taking these points into account, I ask for your expertise to be able to create a model and suitable with the needs that I have.

Without further ado, I remain attentive to your response.



We will rely on Foursquare to have the necessary information of the places, as well as their popularity and the business line that is of interest.

In order to locate each of the colonies in the determined areas of Mexico City, we will access the INEGI portal, which is the National Institute of Statistics and Geography of Mexico, through a web query, we can download a csv file with the geographic coordinates of all the neighborhoods of the City and to be able to work on these data.

In the question of the procedure, we can highlight the places of Gourmet turnaround related to the interest of my client and associate the types of businesses and sites that exist around it, in order to associate a set of behavior related to the gourmet sector and thus be able to extrapolate this set to a new town in the city

Import dependencies that we will need


Preview of the Data obtained

Loading output library...

Filter the DataFrame with the data of Borough,Neighborhood,Latitude and Longitude

Loading output library...

Use geopy library to get the latitude and longitude values of Mexico City.


Create a map of Mexico City with neighborhoods superimposed on top.

Loading output library...



The main component of analysis in this study is by means of the Foursqare search tool.

Through this tool we will obtain the necessary information about the most visited venues in Mexico City.

Dimension of the Data.


The 16 Delegations or Boroughs that make up Mexico City have a number of neighborhoods, the list of these neighborhoods and their coordinates are obtained through the INEGI database mentioned in the previous section.

Therefore, when downloading said database, we obtain that in Mexico City there are 1232 neighborhoods.

Due to the immense number of neighborhoods, and therefore the queries of the neighborhood venues that will be on Foursquare exceeds the allowed number of daily consultations and customer requirements, We will analyze the main Boroughs that are Miguel Hidalgo and Cuauhtemoc to base our study

These Boroughs are the most representative of the restaurant sector of the city.

For this reason, my client wants this to be the area in which the behavior of the target businesses (Safood, Gourmet, Aged meat) is analyzed with respect to the most visited places in this area.

We want to know the Venues of two specific Boroughs : Miguel Hidalgo and Cuauhtemoc


Define Foursquare Credentials and Version


Explore Neighborhoods in Mexico City


Get Near Venues in Mexico City

Loading output library...

Let's check how many venues were returned for each neighborhood

Loading output library...

Analyze Each Neighborhood

Loading output library...

Next, let's group rows by neighborhood and by taking the mean of the frequency of occurrence of each category

Loading output library...

Let's print each neighborhood along with the top 5 most common venues


Obtain information about the characteristics of the business of interest to the client


Get relevant part of JSON and transform it into a pandas dataframe

Loading output library...
Loading output library...
Loading output library...

Define information of interest and filter dataframe

Loading output library...
Loading output library...
Loading output library...

Obtain a map with the Business of interest

Loading output library...

make a dataframe from the resutls

Loading output library...

Create the new dataframe and display the top 10 venues for the principal neighborhoods .

Loading output library...



The process will consist in obtaining first the venues with the characteristics that we are looking for in your category.

once obtained these data, they will be contrasted with the most visited places in these Boroughs.

To carry out this analysis, a cluster will be made regarding the most visited venues in the Boroughs Miguel Hidalgo and Cuautemoc.

In this step we will compare how the most visited places are geographically related to the target venues in our project.

Once we have said analysis, we will obtain the information of the venues of interest and the most visited ones but for the Borough Benito Juarez, which is the Borough where the client wishes to open his new business.

Cluster Neighborhoods


Run k-means to cluster the neighborhood into 5 clusters.

Loading output library...
Loading output library...

Obtain a map with the cluster of top venues in the Boroughs of interest and the target bussines

Loading output library...

Target Borough


Within the Borough target that is Benito Juárez, it was found which is the neighborhood with the greatest potential due to its proximity to the top venues previously analyzed. Once the target neighborhood has been selected, the venues of that neighborhood are obtained and filtered with respect to which already exist that its category is similar to that which the client seeks to open.

In this case, you get what category of venue is needed in that neighborhood and what is the distribution of the other venues for that geographical area

Get the data of the Borough where our client prospects his business

Loading output library...



Let's check the venues in this Borough

Loading output library...

Analyze the Borough

Loading output library...

Next, let's group rows by neighborhood and by taking the mean of the frequency of occurrence of each category

Loading output library...

Let's print each neighborhood along with the top 10 most common venues

Loading output library...

Cluster Neighborhoods

Loading output library...

Let's create a new dataframe that includes the cluster as well as the top 10 venues for each neighborhood.

Loading output library...

Visualize the resulting clusters

Loading output library...

Add to the map the target businnes to analyze

Loading output library...

View the map and the cluster with most visit venues, for Neighborhood of opotunity in the target Borough take a look in Narvarte Poniente Neighborhood

Loading output library...

Let's check the venues in this Neighborhood

Loading output library...

Which of these businesses belong to the same category that our client intends to open

Loading output library...

Add to the map the businnes in the new target Neighborhood

Loading output library...

In this analysis we were able to observe which are the largest venues in the city of Mexico that belong to the Cuautemoc Boroughs and Miguel Hidalgo, as well as where the areas of greatest concentration of people that can be potential clients are located.

The areas with the highest concentration of successful venues showed us a behavior with respect to the venues of the target category to which we want to describe.

It is common for these to be near the most visited venues or venues top, however there is some relaxation in distance with respect to these clusters.

The economic sector of the people who visit the venues of the two main Boroughs of this study is greater than what is intended to be opened in the Benito Juarez Borough.

The Narvarte Poniente neighborhood represents a potential area for a place specializing in aged meat and gourmet products, due to the closeness it has with well-visited venues and the fact that there is no such business in the neighborhood.



Access to Foursquare


One of the issues to improve the study is to have greater access to queries in Foursquare to have a larger database and to make predictions with more formidable data.

The large number of neighborhoods that Mexico City contains makes it more convenient to do this analysis with queries on Foursquare that require premium queries.

Venues categories


Specialized gourmet places in Mexico City sometimes do not carry a good categorization in the field of venue category that offers foursquare. It is useful in future studies access to data that are not specifically of this tool to give more support to the real category that the venues have.



From the study we can conclude that the Benito Juarez Borough is a potential location for the establishment of gourmet venues due to the good geographic location that exists with the most frequented venues of the clientele that prefers these types of places for consumption.

It is considered that the location within the neighborhood Narvarte Poniente is better because the category of venues in that area still does not exploit the specialized gourmet sites within the area, although if there are only two places of Seafood and Steakhouse but no precisely meet the specialized gourmet category sought by our client

We can conclude that:


#1. The neighborhood analyzed is close to the most visited venues clusters #2. In the Narvarte Poniente neighborhood there are only two business types similar to the client's objective #3. There is no Gourmet business in the area, nor old meat, so it can be a neighborhood of opportunity to set up a business of this nature