Barcelona (Part — II)

Sourin Karmakar
10 min readSep 24, 2019

Exploring the city

I have done some work in my previous blog on Barcelona with the Barcelona data sets available in kaggle

Now in this blog I would like to explore more on Barcelona and try to get some insights about the city by using remaining datasets.

In my last blog I have given some demographical information about the city.

For this blog I have chosen the accidents in Barcelona data set for analysis and also I will analyse the Immigration and Emigration pattern in Barcelona.

Accidents in Barcelona

Here the data set on accident contains records of all the accidents that happened in year 2017. The data set contains the information like

  • when the accident occurred (date,time)
  • Where the accident occurred (latitude and longitude)
  • How many vehicles were involved and
  • How many victims in accident.

So these data are enough to analyse a lot about the accidents in Barcelona.

Let’s see the time line of accidents for year 2017

So the time series shows no.of victims in the y-axis and the time in the x-axis. The red line shows average no.of victims in a day and the data is taken from Jan-01–2017 to Dec-31–2017.

From this trend one thing we can observe that the month of August has least no.of victims as most of the data is below that red average line. Whereas month of June and November shows a huge no.of victims. Let’s go deeper and see these trends.

Now we will see the pattern of accidents month wise.

From the above chart we can clearly see that November has the most no.of victims whereas August as I have said from the time series has the least no.of victims.

The reason of less number accidents occurring during August as far as I have tried to find out. In Barcelona the August is the month of Summer season and has highest temperatures during this month, so there may be lesser no.of people who likes to go out during the summer afternoon outside :-) (May not true but an assumption).

Now let’s see which day is more dangerous to go out in Barcelona

Now from the above chart we can see that Friday is the most accident prone day whereas Sunday is least accident prone day. One more point is both Saturday and Sunday are least accident prone days.

The reason for more accidents in Friday may be that Friday is the last working day of a week and people may rush to their offices in order to complete pending tasks or weekly targets. Similarly as it said that Tuesday is the most productive day of the week, so number of accidents are also more in this productive day (ranking second in terms of no.of victims).

There is an obvious reason why Saturday and Sunday has least accidents. Because most of the people are not going for work on these days.

Now we will see the pattern of accident for hours in a day.

From the above chart we can observe that

  • During the working hours like morning 8 am to night around 10 am the no.of accidents are very high. And the most number of accidents are occurring during 1 pm to 3 pm.
  • The reason is many people are going for work during 8 am to 10 am and then during 12 pm to 2 pm for lunch or may be other work and 4 pm onward returning back from work.
  • From 10 pm to morning 6 am most of the people will sleep so obviously there will lesser no.of accidents and lesser victims during this time.

The above graph shows similar information as the above one but here the entire day has been divided into three parts as per the data and the results are also similar as the above one i.e. afternoon has the most no.of accident victims and night has the least no.of accident victims. The time considered here is as per the data given, no manipulation has been done.

In the above three cases shown, a bar graph will be effective because we are comparing nominal values like months v/s no.of victims etc. Even though months are not nominal in nature (represents time but still I have considered them as nominal entry here in order to rank them according to no.of victims.)

Now the question is where the number of accidents and victims are more i.e. which street has most number of accident.

On plotting the accident’s latitudes and longitudes on the map of Barcelona we get the exact streets along with no.of victims. So from the above picture it is clear that the major streets are more prone to accident.

And by observation we can see that the roads that are leading to the heart of the city and the roads that are connecting Barcelona to other cities and the streets which are busy are more prone to accident!

Here a geographical visualisation can give an idea about positions and density of accidents along with a table representing other details.

So this is the analysis that I have done so far in order to understand the accident pattern in Barcelona.

Now we are going to see the Immigration and Emigration pattern in Barcelona and try to get some insights out of the datasets.

Immigration and Emigration in Barcelona

For this analysis I have used several data sets on Immigration and Emigration. This includes Immigration and Emigration by nationality, age, gender etc.

First we will look into Immigration and Emigration by nationality.

So in this data set we are given with 3 years of data i.e. 2015,2016 and 2017.

The no.of immigrants have increased from 2016 to 2017 and we also see the emigrants plot

Similarly the no.of emigrants has decreased from 2015 to 2016 drastically but again there is a little increment in the number from 2016 to 2017. But individually this two plots are not giving information about the total effect of immigration and emigration.

From this chart we can see that the ratio of immigrants to emigrants is increasing by year i.e. as year passing by, the no.of immigrants are also increasing and with this we can say that many people are immigrating to Barcelona. May be this city is creating a lot job opportunities or may be because of good higher education many people are immigrating to Barcelona.

And also if you observe the ratio of Immigration to emigration is ranging from 1.65 to 1.85.

Now let’s go more deeper into the nations from where people are more immigrating. For this I have taken data for year 2017 and 2016 and got the top 15 Immigrating nations.

We can see most are from Spain (other states of Spain) followed by Italy (neighbouring nation) then China! Followed by Spanish speaking South American countries like Colombia,Venezuela etc. And then Pakistan! And we can see India also is in top 25. Many people from Morocco (neighboring country but in African continent, very close to Spanish border) are also immigrating into Barcelona.

Now we will see the pattern in year 2016

It is quite similar as Spain, Italy leading the chart and almost it is same as year 2017. UK and India are not there in top 15 in year 2016.

Now we will see the age wise Immigration and Emigration distribution for year 2017 as that was the latest data available.

Now this distribution chart is explaining a lot about the Immigration and Emigration pattern, age wise. From here we can clearly observe that people with age group 20 to 40 are Immigrating into the Barcelona. This information means that mostly people immigrate into the city for work, higher education etc. Similarly people with age group 25 to 45 are emigrating out of the city mostly may be for work purpose. So this information is crucial to understand that Barcelona is creating a lot of job opportunities and also a very dynamic city in terms of jobs.

The above chart is gives a lot of information but let’s go a little deeper and understand the trend in detail.

This chart is giving ratio between Immigration and Emigration for all the age groups. As the previous chart displayed that age group from 20 to 40 is immigrating more, it is now clear from this chart. The immigration to emigration ratio fro age group 20 to 24 is highest i.e. 3.77 ~ 4, which means the immigration is 4 times more than emigration for this age group. Another interesting trend which we can see from age group 65 onward is the amount of emigration is more than immigration. The reason can be this, after their retirement people leave the city and goes to stay in their native places. One more thing we can conclude from here is that the city of Barcelona is not friendly towards elderly people.

Now we have nation wise pattern for Emigration and Immigration. In both of the cases we have seen the Spain is leading the chart. So we will explore where exactly people are Immigrating and Emigrating.

From this chart we can see that most of the people are Immigrating from Abroad.But another observation is that around 30% of people are Immigrating from Catalonia(the state in Spain where Barcelona is located). And rest of the Immigrants in small percentages are from other Spanish states including community of Madrid.

This chart is showing a different outcome where we can see that Catalonia is leading the chart. This means most of the people are emigrating to other places of Catalonia. And only around 10% people are going to abroad and then the trend is similar where in small percentages people are moving to other Spanish states.

We have seen most of the elderly people are emigrating out, we from this we can say that elderly people are leaving the city of Barcelona to live in the other non crowded towns in Catalonia. We also saw that many people from Catalonia are immigrating to Barcelona, so may be after there work they return back to their respective home towns. Another interesting trend is that many people who are coming from abroad are going back, so we can infer that many people from other nation are getting settles in Barcelona.

Now we will look into gender wise pattern for immigration and emigration. For this the data was obtained from year 2013 to 2017 (5 years data).

This bar chart shows that from year 2013 to 2015 mostly males were immigrating and emigrating whereas from year 2016 onward we can see the trend shifts towards females. This chart even though not so precisely showing numbers but is clearly indicating that Barcelona is creating more opportunities for female and also females may be feeling Barcelona is a safer place for them to work.

Now this line chart actually shows the shift in trend for Immigration from year 2013 to 2017. Not only the trend shift, all together it is also showing the increase in the amount immigration that is happening in Barcelona.

Similarly we have the trend for emigration also. From the above chart we can see that the no.of males and females emigrating from Barcelona is almost the same but from 2015 more females are emigrating from Barcelona. This chart also shows that the amount of emigration is reducing as the time passes by.

Now we will take a look on the district wise Immigration and Emigration pattern.

As we are discussing on gender wise Emigration and Immigration so let’s see the district wise pattern for male and female. I have considered data for year only 2017 as it is latest.

In case of female, most of them are immigrating into Eixample, as Eixample is the city centre so more offices and work places will be located. And also we can see that for all the districts the no.of Immigration is more than Emigration.

Now in case of Males, we see that is Eixample is leading the chart for the similar reason but I would like to guess why in second place Ciutat Vella is there. Since this district is having, more of heavy man power is required. So, most males may immigrate to work in the ports (heavy work).

Now let’s see the overall picture of the immigration and emigration pattern for year 2017.

Results showing that for all the districts, the no.of immigration is more than emigration and also Eixample is leading the chart.

So with this I conclude the blog. In my next blog I am going to do some visualisations depicting the transportation facilities in Barcelona.

--

--