Setting up a resturant in Barcelona

1. Introduction


Barcelona is one of the most populated cities in Spain. It has a lot of people from different ethnic backgrounds that provides lots of different dishes and an own popular mediterranean cuisine that attracts the attention of millions of tourists yearly.
The objective of this project is to use Foursquare location data in order to clustering the differents boroughs of Barcelona on the basis of their restaurants. It will determine what might be the most suitable borough in Barcelona to open a restaurant. In addition to it, we will import and analyze another data in order to make the best decision about in which borough are we going to start our business.
We want to start a malaysian restaurant because we travel there frequently and we have specialized in cooking that type of typical food. Moreover, Barcelona doesn't has a lot of this specific kind of restaurants.



2. Data Description


The data required will be imported from the webpages that contain the needed information and imported from the appropriate packages.
The list of boroughs will be providen by Wikipedia, the geographical location of the boroughs will come from the geocoder package, the venue data pertaining to the different retaurants will come via Foursquare and the other information imported will come from different official webpages around the internet with the updated information.



3. Methodology


First of all I imported numpy as np and pandas as pd.

Secondly, I imported Barcelona's boroughs information from Wikipedia as a dataframe



Then, all the innecessary information was cleaned and the columns were renamed



The next step was to install geopy and folium in order to calculate the coordinates and visualize the Barcelona's map

I needed to change the name of the borough "Gràcia" to "Barri de Gràcia, Barcelona" because geopy locates "Gràcia" in Greece and it's not correct. The name of the borough has to be "Barri de Gràcia, Barcelona" in order to have the correct coordinades. 

So the code I wrote was


 Then I could extract all the correct coordinates with the next code



The next step was importing libraries and creating a map with folium, were we can distinguish the 10 boroughs of barcelona




In order to explore all the information of the boroughs of Barcelona, I needed to log the Foursquare information and create the next code





I wanted to create a dataframe with the total number of each type of restaurant in Barcelona



Creating the dataframe of the top 10 restaurants, sorted descending


And creating a matplot with the result


How many restaurants are in each borough


There are 2 boroughs without any restaurant (Sants-Montjuïc and Sarrià-St Gervasi).

Using "one hot encoding" for extracting the number of the different types of restaurant in each borough.


And in relative numbers


The top 5 types of restaurants of each borough




And the top 5 restaurants of each borough in an only dataframe


Setting the number of clusters that we want to differentiate and adding the number of cluster of each borough to the dataframe



Creating the map with the different clusters



The different clusters are:




Now that we have all the information about the quantity of different types of restaurants in each borough, let's import some more relevant data

Importing statistics of commercial establishment crime in Barcelona



Cleaning the dataframe and renaming columns and rows


Considering robbery as the crime wich we give the most importance, we are going to sort the data according to that variable


With the data sorted correctly we can affirm that Eixample is the most insecure borough for openning a restaurant, followed by Sarrià-S.Gervasi


Importing statistics of cost of square meter in Barcelona


Cleaning and renaming the columns of the dataframe


With this data we can affirm that Sarrià-San Gervasi has the highest price per square meter, followed by Les Corts



4. Results

  • Sant Martí is the borough with the most asian restaurants, followed by Gràcia. Both belong to cluster one (1)
  • The borough with the most criminality is Eixample, followed by Sarrià-S.Gervasi and Sant Martí
  • The borough with the highest cost of square meter in Barcelona is Sarrià-S.Gervasi, followed by Les Corts and Eixample


5. Discussion


With all this data, we can create different scenarios, so in function of our situation, we can choose one or another:
  • If we want to undertake our business in a borough without high criminality, we will exclude Eixample, Sarrià-S.Gervasi and Sant Martí of our candidates
  • If we can't afford to pay a higher price for square meter, we will exclude Sarrià-S.Gervasi, Les Corts and Eixample
  • If we want to undertake the restaurant in a borough with some asian restaurants, we will opt for cluster number one (that means boroughs Sant Martí and Gràcia)


6. Conclusion


As we only can afford to pay a maximum of 3.500€ for square meter,  we have to choose one of the five bottom boroughs. 

Also, we want to have asian restaurants nearly because we want to tap into potential customers, so we will place our restaurant in cluster 1 (that is the cluster with the most asian restaurants. It comprises Sant Martí and Gràcia), as Gràcia is too expensive, we can only opt for Sant Martí.

Comentarios