A brief Exploratory Data Analysis on Spanish Electricity consumption
Author’s Note: The following Exploratory Data Analysis that you are going to read is one of the projects done at the Data Analytics Bootcamp at Ironhack Barcelona, in July 2019. The following GitHub Repository contains all the code in form of Jupyter Notebook as well as the datasets used to perform the analysis.
We can realize and we should admit that we are suffering the consequences of the climate change. According to the International Energy Agency:
The global energy demand rose by 2.3% in 2018, being the fastest pace in the last decade.
Day by day we are using electricity for most of our home appliances and also for our mobility, being part of the electricity increase overall.
The European Commission works on defining Climate Strategies and targets to tackle climate change and CO2 emissions. For this reason, EU has developed the 2020 Climate and Energy Package. This package sets three objectives:
- 20% improvement in energy efficiency
- 20% cut in greenhouse gas emissions (from 1990 levels)
- 20% of EU energy from renewables
Hence, the idea of this article is to analyze the electricity consumption in Spain to analyze whether we are on the path towards a more sustainable electricity consumption, and also if there are some patterns that we are following as users.
Since we are working with data to answer our questions and test our hypotheses; the main questions that raised to our minds are:
Do we follow specific patterns as end-users?
Are we on the path for 20–20–20 objectives?
Is electricity consumption increasing?
Where does the data come from?
In this case, the data analyzed here comes from the Spanish Transmission System Operator (TSO), Red Eléctrica de España (REE). This entity has recently upgraded their transparency platform called E-SIOS, where anyone can retrieve data about generation, consumption, Day-Ahead market price, Intraday market price and flexibility services by means of interruptible demand. In this article, we are assessing data from 2014 to 2018 electricity consumption Spain, in a national level.
Do we follow any specific consumption pattern?
In order to analyze our electricity consumption, let’s first take a look at how it looks like. In the Figure below, we can see the electricity consumption in Spain for last Sunday 21st of July and Sunday 22nd of July, 2019. From this graph we can see that the electricity consumption follow some patterns and we can define some peak-hours, where the electricity consumption reaches its maximum and other time periods where the electricity consumption is at minimum levels.
To better analyze our user-patterns in our electricity consumption let’s try to improve the line plot above, by considering the resources that cover each time-slot of the two analyzed days. On Figure 2, we are representing the same period of time but we are considering the sources that cover each time period and we can also visually see the difference between Sunday the 21st and Monday the 22nd of July.
Actually, we can conclude that we do have some patterns as end-users based on our electricity consumption:
- Consumption on Weekends is lower than during weekdays.
- The peak hours are located at noon, between 12pm and 3pm.
- The off-peak hours are located at night or early morning, between 5–7am.
Also, from the graph above we can see that there are some resources that are used to cover the baseline of the electricity consumption and there are others that are used to cover peak-hours or, in case of renewables, they inject power whenever they produce electricity. This is the case of nuclear power plants. They have a long response period in front of changes, and this is why they cannot cover demand peaks as for example CHP, coal and natural gas can do. Regarding this, hydro power plants are used to cover peaks on demand. On the other hand, sources as Wind, solar PV and Solar Thermal inject power where they produce, since Renewable Energy Sources (RES) are intermittent. One insight that can be extracted from here are the time-period where RES produce:
- Solar PV: between 9am and 7pm
- Wind: between 9pm and 7am (Maximum Power Injection)
Are we on the path towards 20–20–20 objectives?
20% Share of renewables?
We want to analyze if we are accomplishing the EU roadmap for 2020 in terms of RES. To answer this question, let’s see what happened in 2018 when we split our yearly electricity generation by source. In Figure 5, we can see that for 2018 we accomplished the roadmap of 2020, with a total share of 48% for renewable energy sources and a 52% for conventional sources. Furthermore, this pie chart can be very insightful to see which are the resources that, in a yearly time horizon, are used to cover the country electricity demand. Spain relies in Nuclear, natural gas, coal and CHP for conventional energy generation. On the other hand, it relies mostly on Wind Power and Hydro when dealing with RES.
It is worth saying that, even if Spain has one of the major solar irradiance values in Europe, it has only 7.76 GW of solar installed capacity and Germany 41.3 GW. Let’s hope that it will change in the upcoming years.
20% increase on energy efficiency?
When we are dealing with energy efficiency it can be difficult to assess whether a country is increasing its energy efficiency in terms of electricity consumption. For this reason, in order to find a quantitative way to assess energy efficiency, we can assume the following hypothesis:
An increase of energy efficiency of 20% can be understood as a 20% decrease of electricity consumption.
For this reason, we are taking a look at the data we have collected from REE and we will try to answer this question by means of visualization and statistical hypotheses testing.
However, when we want to implement some statistics and perform hypotheses testing we should first assess whether our data is normally distributed. Besides, by means of a normality test we can also prove that this data follows a normal distribution with a Confidence Interval of 95%.
Is electricity consumption increasing?
Our last question wants to dig a little bit deeper into the electricity consumption depending on the year and other variables. When we take a look at our data in a visual manner, we cannot conclude that there’s a significat change in our electricity consumption comparing to previous years, as can be seen on Figure 6.
However, by means of an hypotheses test we can prove our hypotheses. In this case, we were wondering that the electricity consumption in 2018 has decreased significantly compared to the historical mean value between 2014–2018.
Based on our analysis, and based on our data to follow a normal distribution, we have applied a T-Student by means of scipy. Hence, obtaining a p-value of 0.001 and a statistic of -3.1189 we can reject our null hypotheses with a confidence interval of 95%. That means that:
Electricity consumption in 2018 has statistically talking significantly decreased compared to previous data from 2014–2018.
More insights on our data
We haven’t stuck only to our initial questions. Our electricity consumption is so interesting, and so we can explain more things about it. When we are talking about Spain, we would think that the electricity consumption would be much higher on summers rather than on winters, right?
Let’s take a look at our data, split by season. What we can see from that, thanks to this box-plot, is that electricity consumption is way greater in winter rather than in Summers. It could be considered as weird, but Spain has a poor isolation in buildings and, even if winters are not that cold compared to Nordic countries, this lack of isolation in buildings makes that a huge amount electricity consumption for heating is needed. As stated by Economics by Energy, a household in Spain spends 47% on heating.
Even if we see that electricity consumption is way higher on winters rather than summers, we want to analyze what has happened during Summers. Our main hypothesis here was that electricity consumption is increasing on summers since 2014. However, according to our data, we can see that electricity consumption reached its maximum level in summer 2015. During that summer electricity consumption reached a maximum level of 800.000 MWh, being this significantly higher compared to other years. When trying to analyze what happened in summer 2015, we realized that, according to the National Aeronautics and Space Administration (NASA), 2015 was the hottest year in the Earth on record.
It is amazing what data can explain to us. We can see that we, as end-users, follow some specific trends based on our electricity consumption. We are not so unique, huh? ;)
After developing this analysis we could say, surprinsingly, we are on the path towards 20–20–20, even if we are not decreasing our electricity consumption by 20%. Hence, what’s next? The goal is to decrease greenhouse gas emissions up to 40% by 2030. Are we going to achieve it?