Learn data science and machine learning by building real-world projects on Jovian

The Energy of Spain: A data analysis from the International Energy Statistics (UN)

This project aims to analyze energy production and consumption in Spain. The data has been taken from an open-source dataset. The dataset is called "International Energy Statistics", and data has been collected by United Nations Organisation. The database contains comprehensive energy statistics on the production, trade, conversion and final consumption of primary and secondary; conventional and non-conventional; and new and renewable sources of energy.

Dataset link: https://www.kaggle.com/unitednations/international-energy-statistics?select=all_energy_statistics.csv

Throughout this project, we are:

  1. Downloading and importing the dataset
  2. Cleaning data, and taking energy data about energy production and consumption in Spain
  3. Exploring the energy production and consumption in Spain, employing data visualization (pie charts, line charts, bar charts, and heatmaps)


Downloading the Dataset

First of all, we must download the dataset from Kaggle.


Let's begin by downloading the data, and listing the files within the dataset.

dataset_url = 'https://www.kaggle.com/unitednations/international-energy-statistics?select=all_energy_statistics.csv' 
import opendatasets as od
od.download(dataset_url)

The dataset has been downloaded and extracted.

Let us save and upload our work to Jovian before continuing.

project_name = "zerotopandas-course-project-energy-statistics"
# !pip install jovian --upgrade -q
import jovian
jovian.commit(project=project_name, filename="zerotopandas-course-project.ipynb", privacy="secret")
[jovian] Please enter your API key ( from https://jovian.ai/ ): API KEY:[jovian] Updating notebook "davidmarpas/zerotopandas-course-project-energy-statistics" on https://jovian.ai/ [jovian] Committed successfully! https://jovian.ai/davidmarpas/zerotopandas-course-project-energy-statistics

Data Preparation and Cleaning

In this part of the document, we are:

  1. Importing the dataset
  2. Getting energy data from Spain
  3. Separating columns to make a better analysis
  4. Remove non desired data
  5. Converting units

Let's load the dataset

import pandas as pd
import numpy as np

# Ignore warnings
import warnings
warnings.filterwarnings('ignore')

energy_df = pd.read_csv("all_energy_statistics.csv")

energy_df.head()

Dataset size

rows = energy_df.shape[0]
cols = energy_df.shape[1]
print("The dataset contains {} columns and {} rows".format(cols,rows))
The dataset contains 7 columns and 1189482 rows

We are specially interested in the data about Spain. Hence, we are getting this data in a separate data frame.

spain_energy_df = energy_df[energy_df["country_or_area"] == "Spain"]
spain_energy_df
print("The dataset with data about Spain has {} rows".format(spain_energy_df.shape[0]))
The dataset with data about Spain has 15815 rows

It seems that in the column commodity_transaction we have information about the product and the energy flow, as explained in the attach documentation (Energy-Questionnaire-Guidelines.pdf).

spain_energy_df.commodity_transaction.unique().tolist()
['Additives and Oxygenates - Imports',
 'Additives and Oxygenates - Stock changes',
 'Additives and Oxygenates - Total energy supply',
 'Additives and Oxygenates - Transformation',
 'Additives and Oxygenates - Transformation in oil refineries',
 'Animal waste - Production',
 'Animal waste - Total energy supply',
 'animal waste - Transformation',
 'Animal waste - Transformation in electricity, CHP and heat plants',
 'Animal waste - Transformation in electricity plants - main activity producers',
 'Anthracite - consumption by iron and steel',
 'Anthracite - consumption by manufacturing, construction and non-fuel industry',
 'Anthracite - consumption by other',
 'Anthracite - consumption by other manuf., const. and non-fuel ind.',
 'Anthracite - consumption in households',
 'Anthracite - consumption not elsewhere specified (industry)',
 'Anthracite - consumption not elsewhere specified (other)',
 'Anthracite - exports',
 'Anthracite - Final consumption',
 'Anthracite - final energy consumption',
 'Anthracite - imports',
 'Anthracite - production',
 'Anthracite - stock changes',
 'Anthracite - Total energy supply',
 'Anthracite - transformation',
 'Anthracite - transformation in electricity, CHP and heat plants',
 'Anthracite - transformation in electricity plants - main activity producers',
 'Aviation gasoline - Consumption by transport',
 'Aviation gasoline - Consumption in domestic aviation',
 'Aviation gasoline - Exports',
 'Aviation gasoline - Final consumption',
 'Aviation gasoline - Final energy consumption',
 'Aviation gasoline - Imports',
 'Aviation gasoline - Production',
 'Aviation gasoline - production from plants',
 'Aviation gasoline - production from refineries',
 'Aviation gasoline - Stock changes',
 'Aviation gasoline - Total energy supply',
 'Aviation gasoline - Transfers and recycled products',
 'Bagasse - Consumption by manufacturing, construction and non-fuel industry',
 'Bagasse - Consumption by other',
 'Bagasse - Consumption by other manuf., const. and non-fuel ind.',
 'Bagasse - Consumption not elsewhere specified (other)',
 'Bagasse - Energy industries own use',
 'Bagasse - Final consumption',
 'Bagasse - Final energy consumption',
 'Bagasse - Other energy industry own use',
 'Bagasse - Production',
 'Bagasse - Total energy supply',
 'Biodiesel - Consumption by agriculture, forestry and fishing',
 'Biodiesel - Consumption by commerce and public services',
 'Biodiesel - Consumption by construction ',
 'Biodiesel - Consumption by food and tobacco ',
 'Biodiesel - Consumption by households',
 'Biodiesel - Consumption by manufacturing, construction and non-fuel mining industry',
 'Biodiesel - Consumption by mining and quarrying ',
 'Biodiesel - Consumption by other',
 'Biodiesel - Consumption by other manufacturing, construction and non-fuel mining industry',
 'Biodiesel - Consumption by road',
 'Biodiesel - Consumption in transport',
 'Biodiesel - Consumption not elsewhere specified (transport)',
 'Biodiesel - Exports',
 'Biodiesel - Final consumption',
 'Biodiesel - Final energy consumption',
 'Biodiesel - Imports',
 'Biodiesel - Production',
 'Biodiesel - Stock changes',
 'Biodiesel - Total energy supply',
 'Biogases - Consumption by agriculture, forestry and fishing',
 'Biogases - Consumption by commerce and public services',
 'Biogases - Consumption by food and tobacco ',
 'Biogases - Consumption by manufacturing, construction and non-fuel mining industry',
 'Biogases - Consumption by non-ferrous metals ',
 'Biogases - Consumption by non-metallic minerals ',
 'Biogases - Consumption by other',
 'Biogases - Consumption by other manuf., const. and non-fuel ind.',
 'Biogases - Consumption by paper, pulp and print',
 'Biogases - Consumption not elsewhere specified (industry)',
 'Biogases - Consumption not elsewhere specified (other)',
 'Biogases - Energy industries own use',
 'Biogases - Final consumption',
 'Biogases - Final energy consumption',
 'Biogases - Other energy industry own use',
 'Biogases - Production',
 'Biogases - Total energy supply',
 'Biogases - Transformation',
 'Biogases - Transformation in CHP plants - autoproducers',
 'Biogases - Transformation in electricity, CHP and heat plants',
 'Biogases - Transformation in electricity plants - autoproducers',
 'Biogases - Transformation in electricity plants - main activity producers',
 'Biogasoline - Consumption by agriculture, forestry and fishing',
 'Biogasoline - Consumption by commerce and public services',
 'Biogasoline - Consumption by Other',
 'Biogasoline - Consumption by road',
 'Biogasoline - consumption by transport',
 'Biogasoline - Consumption not elsewhere specified (transport)',
 'Biogasoline - exports',
 'Biogasoline - Final consumption',
 'Biogasoline - Final energy consumption',
 'Biogasoline - imports',
 'Biogasoline - production',
 'Biogasoline - stock changes',
 'Biogasoline - Total energy supply',
 'Bitumen - Exports',
 'Bitumen - Final consumption',
 'Bitumen - Imports',
 'Bitumen - Non-energy uses',
 'Bitumen - Production',
 'Bitumen - production from refineries',
 'Bitumen - Stock changes',
 'Bitumen - Total energy supply',
 'Bitumen - Transfers and recycled products',
 'Black Liquor - Consumption by manufacturing, construction and non-fuel mining industry',
 'Black Liquor - Consumption by other manuf., const. and non-fuel ind.',
 'Black Liquor - Final consumption',
 'Black Liquor - Final energy consumption',
 'Black Liquor - Production',
 'Black Liquor - Total energy supply',
 'Blast Furnace Gas - Consumption by chemical and petrochemical',
 'Blast Furnace Gas - Consumption by iron and steel',
 'Blast Furnace Gas - Consumption by manufacturing, construction and non-fuel industry',
 'Blast Furnace Gas - Energy industries own use',
 'Blast furnace gas - final consumption',
 'Blast Furnace Gas - Final energy consumption',
 'Blast Furnace Gas - Losses',
 'Blast Furnace Gas - Own use by coke ovens',
 'Blast Furnace Gas - Production',
 'Blast furnace gas - Total energy supply',
 'Blast furnace gas - Transformation',
 'Blast Furnace Gas - Transformation in CHP plants - autoproducers',
 'Blast Furnace Gas - Transformation in electricity, CHP and heat plants',
 'Blast Furnace Gas - Transformation in electricity plants - autoproducers',
 'Blast Furnace Gas - Transformation in electricity plants - main activity producers',
 'Brown coal briquettes - imports',
 'Brown coal briquettes - Total energy supply',
 'Brown coal briquettes - Transformation',
 'Brown coal briquettes - Transformation in electricity, CHP and heat plants',
 'Brown coal briquettes - Transformation in electricity plants - main activity producers',
 'Brown coal - changes in stocks',
 'Brown coal - consumption by chemical and petrochemical industry',
 'Brown coal - Consumption by commerce and public services',
 'Brown coal - consumption by households',
 'Brown coal - consumption by manufacturing, construction and non-fuel mining industry',
 'Brown coal - Consumption by non-metallic minerals industry',
 'Brown coal - consumption by Other',
 'Brown coal - consumption by other manuf., const. and non-fuel ind.',
 'Brown coal - Consumption by paper, pulp and print',
 'Brown coal - consumption in agriculture, forestry and fishing',
 'Brown coal - Consumption not elsewhere specified (industry)',
 'Brown coal - energy industries own use',
 'Brown coal - final consumption',
 'Brown coal - Final energy consumption',
 'Brown coal - imports',
 'Brown coal - own use by coal mines',
 'Brown coal - production',
 'Brown coal - Total energy supply',
 'Brown coal - transformation',
 'Brown coal - Transformation in electricity, CHP and heat plants',
 'Brown coal - Transformation in main activity electricity plants',
 'Lignite brown coal - additional resources',
 'Lignite brown coal- recoverable resources',
 'Lignite brown coal - total known reserves',
 'Lignite brown coal - total resources in place',
 'Charcoal - Consumption by households',
 'Charcoal - Consumption by other',
 'Charcoal - Final consumption',
 'Charcoal - Final energy consumption',
 'Charcoal - Production',
 'Charcoal - Total energy supply',
 'Coal Tar - Consumption by chemical and petrochemical',
 'Coal Tar - Consumption by construction ',
 'Coal Tar - Consumption by manufacturing, construction and non-fuel mining industry',
 'Coal Tar - Consumption by other manufacturing, construction and non-fuel mining industry',
 'Coal Tar - Energy industries own use',
 'Coal Tar - Final consumption',
 'Coal Tar - Final energy consumption',
 'Coal Tar - Non-energy uses',
 'Coal Tar - Own use by coke ovens',
 'Coal Tar - Production',
 'Coal Tar - Total energy supply',
 'Coke Oven Gas - Consumption by chemical and petrochemical',
 'Coke Oven Gas - Consumption by iron and steel',
 'Coke Oven Gas - Consumption by manufacturing, construction and non-fuel industry',
 'Coke Oven Gas - Energy industries own use',
 'Coke Oven Gas - Final consumption',
 'Coke Oven Gas - Final energy consumption',
 'Coke Oven Gas - Losses',
 'Coke Oven Gas - Own use by coke ovens',
 'Coke Oven Gas - Production',
 'Coke Oven Gas - Total energy supply',
 'Coke Oven Gas - Transformation',
 'Coke Oven Gas - Transformation in CHP plants - autoproducers',
 'Coke Oven Gas - Transformation in electricity, CHP and heat plants',
 'Coke Oven Gas - Transformation in electricity plants - autoproducers',
 'Coke Oven Gas - Transformation in electricity plants - main activity producers',
 'Coke Oven Gas - Transformation in gas works',
 'Coking coal - consumption by manufacturing, construction and non-fuel industry',
 'Coking coal - consumption by other manuf., const. and non-fuel ind.',
 'Coking coal - consumption not elsewhere specified (industry)',
 'Coking coal - energy industries own use',
 'Coking coal - exports',
 'Coking coal - final consumption',
 'Coking coal - final energy consumption',
 'Coking coal - imports',
 'Coking coal - losses',
 'Coking coal - own use by coke ovens',
 'Coking coal - production',
 'Coking coal - stock changes',
 'Coking coal - total energy supply',
 'Coking coal - transformation',
 'Coking coal - transformation in coke ovens',
 'Conventional crude oil - consumption by non-metallic minerals',
 'Conventional crude oil - final consumption',
 'Conventional crude oil - final energy consumption',
 'Conventional crude oil - imports',
 'Conventional crude oil - production',
 'Conventional crude oil - production from off-shore',
 'Conventional crude oil - stock changes',
 'Conventional crude oil - total energy supply',
 'Conventional crude oil - transfers and recycled products',
 'Conventional crude oil - transformation',
 'Conventional crude oil - transformation in oil refineries',
 'Crude petroleum - consumption by chemical and petrochemical',
 'Crude petroleum - consumption by manufacturing, construction and non-fuel mining industry',
 'Crude petroleum - consumption by other manufacturing, construction and non-fuel mining industry',
 'Crude petroleum - refinery capacity',
 'Crude petroleum - reserves',
 'Crude petroleum - reserves from oil shale',
 'Crude petroleum - reserves from oil shale and tar sands',
 'Direct use of geothermal heat - Consumption by agriculture, forestry and fishing',
 'Direct use of geothermal heat - Consumption by commerce and public services',
 'Direct use of geothermal heat - Consumption by construction',
 'Direct use of geothermal heat - Consumption by food and tobacco',
 'Direct use of geothermal heat - Consumption by households',
 'Direct use of geothermal heat - Consumption by manufacturing, construction and non-fuel mining industry',
 'Direct use of geothermal heat - Consumption by other',
 'Direct use of geothermal heat - Consumption by other manuf., const. and non-fuel ind.',
 'Direct use of geothermal heat - Final energy consumption',
 'Direct use of solar thermal heat - Consumption by agriculture, forestry and fishing',
 'Direct use of solar thermal heat - Consumption by chemical and petrochemical',
 'Direct use of solar thermal heat - Consumption by commerce and public services',
 'Direct use of solar thermal heat - Consumption by construction',
 'Direct use of solar thermal heat - Consumption by food and tobacco',
 'Direct use of solar thermal heat - Consumption by households',
 'Direct use of solar thermal heat - Consumption by machinery',
 'Direct use of solar thermal heat - Consumption by manufacturing, construction and non-fuel mining industry',
 'Direct use of solar thermal heat - Consumption by mining and quarrying',
 'Direct use of solar thermal heat - Consumption by non-ferrous metals',
 'Direct use of solar thermal heat - Consumption by non-metallic minerals',
 'Direct use of solar thermal heat - Consumption by other',
 'Direct use of solar thermal heat - Consumption by other manuf., const. and non-fuel ind.',
 'Direct use of solar thermal heat - Consumption by paper, pulp and print',
 'Direct use of solar thermal heat - Consumption by textile and leather',
 'Direct use of solar thermal heat - Consumption by transport equipment',
 'Direct use of solar thermal heat - Consumption not elsewhere specified (industry)',
 'Direct use of solar thermal heat - Consumption not elsewhere specified (other)',
 'Direct use of solar thermal heat - Final energy consumption',
 'Electricity generating capacity - From other sources - Autoproducers',
 'Electricity generating capacity - From other sources - Total',
 'Electricity generating capacity - Pumped hydro - Main activity producers',
 'Electricity generating capacity - Pumped hydro - Total',
 'Electricity generating capacity - Solar PV - Autoproducers',
 'Electricity generating capacity - Solar PV - Main activity producers',
 'Electricity generating capacity - Solar PV - Total',
 'Electricity generating capacity - Solar Thermal - Main activity producers',
 'Electricity generating capacity - Solar Thermal - Total',
 'Electricity - net installed capacity of electric power plants, public combustible fuels',
 'Electricity - net installed capacity of electric power plants, public hydro',
 'Electricity - net installed capacity of electric power plants, public nuclear',
 'Electricity - net installed capacity of electric power plants public solar',
 'Electricity - net installed capacity of electric power plants, public wind',
 'Electricity - net installed capacity of electric power plants, self-producer combustible fuels',
 'Electricity - net installed capacity of electric power plants, self-producer hydro',
 'Electricity - net installed capacity of electric power plants, self-producer solar',
 'Electricity - net installed capacity of electric power plants, self-producer wind',
 'Electricity - total net installed capacity of electric power plants, autoproducer',
 'Electricity - total net installed capacity of electric power plants, combustible fuels',
 'Electricity - total net installed capacity of electric power plants, hydro',
 'Electricity - total net installed capacity of electric power plants, main activity',
 'Electricity - total net installed capacity of electric power plants, main activity & autoproducer',
 'Electricity - total net installed capacity of electric power plants, nuclear',
 'Electricity - total net installed capacity of electric power plants, solar',
 'Electricity - total net installed capacity of electric power plants, wind',
 'Falling water - total hydraulic resources',
 'Fuel oil - Consumption by chemical and petrochemical',
 'Fuel oil - Consumption by commerce and public services',
 'Fuel oil - Consumption by construction ',
 'Fuel oil - Consumption by domestic navigation',
 'Fuel oil - Consumption by food and tobacco ',
 'Fuel oil - Consumption by households',
 'Fuel oil - Consumption by iron and steel',
 'Fuel oil - Consumption by machinery ',
 'Fuel oil - Consumption by manufacturing, construction and non-fuel industry',
 'Fuel oil - Consumption by mining and quarrying ',
 'Fuel oil - Consumption by non-ferrous metals ',
 'Fuel oil - Consumption by non-metallic minerals ',
 'Fuel oil - Consumption by other',
 'Fuel oil - Consumption by other manuf., const. and non-fuel ind.',
 'Fuel oil - Consumption by paper, pulp and print',
 'Fuel oil - Consumption by textile and leather ',
 'Fuel oil - Consumption by transport',
 'Fuel oil - Consumption by transport equipment ',
 'Fuel oil - Consumption by wood and wood products ',
 'Fuel oil - Consumption in agriculture, forestry and fishing',
 'Fuel oil - Consumption not elsewhere specified (industry)',
 'Fuel oil - Consumption not elsewhere specified (other)',
 'Fuel oil - Energy industries own use',
 'Fuel oil - Exports',
 'Fuel oil - Final consumption',
 'Fuel oil - Final energy consumption',
 'Fuel oil - Imports',
 'Fuel oil - International marine bunkers',
 'Fuel oil - Own use by coke ovens',
 'Fuel oil - Own use by oil refineries',
 'Fuel oil - Production',
 'Fuel oil - production from refineries',
 'Fuel oil - Stock changes',
 'Fuel oil - Total energy supply',
 'Fuel oil - Transfers and recycled products',
 'Fuel oil - Transformation',
 'Fuel oil - Transformation in CHP plants - autoproducers',
 'Fuel oil - Transformation in CHP plants - main activity producers',
 'Fuel oil - Transformation in electricity, CHP and heat plants',
 'Fuel oil - Transformation in electricity plants - autoproducers',
 'Fuel oil - Transformation in electricity plants - main activity producers',
 'Fuel oil - Transformation in petrochemical plants',
 'Fuelwood - Consumption by commerce and public services',
 'Fuelwood - Consumption by households',
 'Fuelwood - Consumption by manufacturing, construction and non-fuel industry',
 'Fuelwood - Consumption by other',
 'Fuelwood - Consumption by other manuf., const. and non-fuel ind.',
 'Fuelwood - Consumption in agriculture, forestry and fishing',
 'Fuelwood - Consumption not elsewhere specified (other)',
 'Fuelwood - Energy industries own use',
 'Fuelwood - Exports',
 'Fuelwood - Final consumption',
 'Fuelwood - Final energy consumption',
 'Fuelwood - Imports',
 'Fuelwood - Own use by electricity, heat and CHP plants',
 'Fuelwood - Production',
 'Fuelwood - Total energy supply',
 'Fuelwood - Transformation',
 'Fuelwood - Transformation in charcoal plants',
 'Fuelwood - Transformation in CHP plants - autoproducers',
 'Fuelwood - Transformation in electricity, CHP and heat plants',
 'Fuelwood - Transformation in electricity plants - autoproducers',
 'Fuelwood - Transformation in electricity plants - main activity producers',
 'Gas Oil/ Diesel Oil - Consumption by chemical and petrochemical',
 'Gas Oil/ Diesel Oil - Consumption by commerce and public services',
 'Gas Oil/ Diesel Oil - Consumption by construction ',
 'Gas Oil/ Diesel Oil - Consumption by food and tobacco ',
 'Gas Oil/ Diesel Oil - Consumption by households',
 'Gas Oil/ Diesel Oil - Consumption by iron and steel',
 'Gas Oil/ Diesel Oil - Consumption by machinery ',
 'Gas Oil/ Diesel Oil - Consumption by manufacturing, construction and non-fuel mining industry',
 'Gas Oil/ Diesel Oil - Consumption by mining and quarrying ',
 'Gas Oil/ Diesel Oil - Consumption by non-ferrous metals ',
 'Gas Oil/ Diesel Oil - Consumption by non-metallic minerals ',
 'Gas Oil/ Diesel Oil - Consumption by other',
 'Gas Oil/ Diesel Oil - Consumption by other manuf., const. and non-fuel min. ind.',
 'Gas Oil/ Diesel Oil - Consumption by paper, pulp and print',
 'Gas Oil/ Diesel Oil - Consumption by textile and leather ',
 'Gas Oil/ Diesel Oil - Consumption by transport',
 'Gas Oil/ Diesel Oil - Consumption by transport equipment ',
 'Gas Oil/ Diesel Oil - Consumption by wood and wood products ',
 'Gas Oil/ Diesel Oil - Consumption in agriculture, forestry and fishing',
 'Gas Oil/ Diesel Oil - Consumption in domestic navigation',
 'Gas Oil/ Diesel Oil - Consumption in rail',
 'Gas Oil/ Diesel Oil - Consumption in road',
 'Gas Oil/ Diesel Oil - Consumption not elsewhere specified (industry)',
 'Gas Oil/ Diesel Oil - Consumption not elsewhere specified (other)',
 'Gas Oil/ Diesel Oil - Consumption not elsewhere specified (transport)',
 'Gas Oil/ Diesel Oil - Energy industries own use',
 'Gas Oil/ Diesel Oil - Exports',
 'Gas Oil/ Diesel Oil - Final consumption',
 'Gas Oil/ Diesel Oil - Final energy consumption',
 'Gas Oil/ Diesel Oil - Imports',
 'Gas Oil/ Diesel Oil - International marine bunkers',
 'Gas Oil/ Diesel Oil - Own use by coal mines',
 'Gas Oil/ Diesel Oil - Own use by oil and gas extraction',
 'Gas Oil/ Diesel Oil - Own use by oil refineries',
 'Gas Oil/ Diesel Oil - Production',
 'Gas Oil/ Diesel Oil - production from refineries',
 'Gas Oil/ Diesel Oil - Receipts from other sources',
 'Gas Oil/ Diesel Oil - Stock changes',
 'Gas Oil/ Diesel Oil - Total energy supply',
 'Gas Oil/ Diesel Oil - Transfers and recycled products',
 'Gas Oil/ Diesel Oil - Transformation',
 'Gas Oil/ Diesel Oil - Transformation in CHP plants - autoproducers',
 'Gas Oil/ Diesel Oil - Transformation in electricity, CHP and heat plants',
 'Gas Oil/ Diesel Oil - Transformation in electricity plants - autoproducers',
 'Gas Oil/ Diesel Oil - Transformation in electricity plants - main activity producers',
 'Gasoline-type jet fuel - Consumption by domestic aviation',
 'Gasoline-type jet fuel - Consumption in transport',
 'Gasoline-type jet fuel - Exports',
 'Gasoline-type jet fuel - Final consumption',
 'Gasoline-type jet fuel - Final energy consumption',
 'Gasoline-type jet fuel - Imports',
 'Gasoline-type jet fuel - Production',
 'Gasoline-type jet fuel - Production from refineries',
 'Gasoline-type jet fuel - Stock changes',
 'Gasoline-type jet fuel - Total energy supply',
 'Gasoline-type jet fuel - Transfers and recycled products',
 'Gasworks Gas - Consumption by commerce and public services',
 'Gasworks Gas - Consumption by food and tobacco ',
 'Gasworks Gas - Consumption by households',
 'Gasworks Gas - Consumption by machinery ',
 'Gasworks Gas - Consumption by manufacturing, construction and non-fuel industry',
 'Gasworks Gas - Consumption by other',
 'Gasworks Gas - Consumption by other manuf., const. and non-fuel ind.',
 'Gasworks Gas - Consumption by wood and wood products ',
 'Gasworks Gas - Consumption not elsewhere specified (industry)',
 'Gasworks Gas - Energy industries own use',
 'Gasworks Gas - Final consumption',
 'Gasworks Gas - Final energy consumption',
 'Gasworks Gas - Losses',
 'Gasworks Gas - Own use by gas works',
 'Gasworks Gas - Production',
 'Gasworks Gas - Receipts from other sources',
 'Gasworks Gas - Total energy supply',
 'Coal - additional resources',
 'Coal - recoverable reserves',
 'Coal - total known reserves',
 'Coal - total resources in place',
 'Hard coal - consumption by chemical and petrochemical industry',
 'Hard coal - consumption by commerce and public services',
 'Hard coal - consumption by food and tobacco industry',
 'Hard coal - consumption by households',
 'Hard coal - consumption by machinery industry',
 'Hard coal - consumption by manufacturing, construction and non-fuel mining industry',
 'Hard coal - consumption by mining and quarrying industry',
 'Hard coal - consumption by non-ferrous metals industry',
 'Hard coal - consumption by non-metallic minerals industry',
 'Hard coal - consumption by other',
 'Hard coal - consumption by other consumers',
 'Hard coal - consumption by other manuf., const. and non-fuel ind.',
 'Hard coal - consumption by paper, pulp and print',
 'Hard coal - consumption not elsewhere specified (industry)',
 'Hard coal - energy industries own use',
 'Hard coal - exports',
 'Hard coal - final consumption',
 'Hard coal - final energy consumption',
 'Hard coal - imports',
 'Hard coal - losses',
 'Hard coal - own use by coal mines',
 'Hard coal - own use by coke ovens',
 'Hard coal - Own use by other energy producers',
 'Hard coal - production',
 'Hard coal - receipts from other sources',
 'Hard coal - stock changes',
 'Hard coal - total energy supply',
 'Hard coal - transformation',
 'Hard coal - transformation in blast furnaces',
 'Hard coal - transformation in briquetting plants',
 'Hard coal - transformation in CHP plants - autoproducers',
 'Hard coal - transformation in coke ovens',
 'Hard coal - transformation in electricity, CHP and heat plants',
 'Hard coal - transformation in electricity plants - autoproducers',
 'Hard coal - transformation in electricity plants - main activity producers',
 'Hrad coal - consumption by iron and steel industry',
 'From combustible fuels – Main activity',
 'From combustible fuels – Main activity – CHP plants',
 'Heat - Gross demand',
 'Heat - Gross production',
 'Heat - Net production',
 'Heat - Own use by electricity, CHP and heat plants',
 'Heat production - Main activity total',
 'Electricity - total hydro production',
 'Industrial Waste - Consumption by manufacturing, construction and non-fuel industry',
 'Industrial Waste - Consumption by non-metallic minerals ',
 'Industrial Waste - Consumption by other manuf., const. and non-fuel ind.',
 'Industrial waste - Final consumption',
 'Industrial Waste - Final energy consumption',
 'Industrial Waste - Production',
 'Industrial waste - Total energy supply',
 'Industrial Waste - Transformation',
 'Industrial waste - Transformation in electricity, CHP and heat plants',
 'Industrial Waste - Transformation in electricity plants - main activity producers',
 'Kerosene-type Jet Fuel - Consumption by domestic aviation',
 'Kerosene-type Jet Fuel - Consumption by other',
 'Kerosene-type Jet Fuel - Consumption by transport',
 'Kerosene-type Jet Fuel - Consumption not elsewhere specified (other)',
 'Kerosene-type Jet Fuel - Exports',
 'Kerosene-type Jet Fuel - Final consumption',
 'Kerosene-type Jet Fuel - Final energy consumption',
 'Kerosene-type Jet Fuel - Imports',
 'Kerosene-type Jet Fuel - International aviation bunkers',
 'Kerosene-type Jet Fuel - Production',
 'Kerosene-type Jet Fuel - production from refineries',
 'Kerosene-type Jet Fuel - Stock changes',
 'Kerosene-type Jet Fuel - Total energy supply',
 'Kerosene-type Jet Fuel - Transfers and recycled products',
 'Lignite - Production',
 'Lignite - Stock changes',
 'Lignite - Total energy supply',
 'Lignite - Transformation',
 'Lignite - Transformation in electricity, CHP and heat plants',
 'Lignite - Transformation in main activity electricity plants',
 'Liquefied petroleum gas (LPG) - consumption by chemical and petrochemical',
 'Liquefied petroleum gas (LPG) - Consumption by households',
 'Liquefied petroleum gas (LPG) - consumption by iron and steel industry',
 'Liquefied petroleum gas (LPG) - consumption by manufacturing, construction and non-fuel mining industry',
 'Liquefied petroleum gas (LPG) - Consumption by other',
 'Liquefied petroleum gas (LPG) - consumption by other manuf., const. and non-fuel min. ind.',
 'Liquefied petroleum gas (LPG) - Consumption by transport',
 'Liquefied petroleum gas (LPG) - Consumption in agriculture, forestry and fishing',
 'Liquefied petroleum gas (LPG) - Consumption in road',
 'Liquefied petroleum gas (LPG) - Energy industries own use',
 'Liquefied petroleum gas (LPG) - Exports',
 'Liquefied petroleum gas (LPG) - Final consumption',
 'Liquefied petroleum gas (LPG) - Imports',
 'Liquefied petroleum gas (LPG) - Non-energy uses',
 'Liquefied petroleum gas (LPG) - Own use by oil refineries',
 'Liquefied petroleum gas (LPG) - Production',
 'Liquefied petroleum gas (LPG) - production from plants',
 'Liquefied petroleum gas (LPG) - production from refineries',
 'Liquefied petroleum gas (LPG) - Stock changes',
 'Liquefied petroleum gas (LPG) - Total energy supply',
 'Liquefied petroleum gas (LPG) - Transfers and recycled products',
 'Liquefied petroleum gas (LPG) - Transformation',
 'Liquefied petroleum gas (LPG) - Transformation in electricity, CHP and heat plants',
 'Liquefied petroleum gas (LPG) - Transformation in gas works',
 'Liquified Petroleum Gas (LPG) - Consumption by commerce and public services',
 'Liquified Petroleum Gas (LPG) - Consumption by construction',
 'Liquified Petroleum Gas (LPG) - Consumption by food and tobacco',
 'Liquified Petroleum Gas (LPG) - Consumption by industries not elsewhere specified',
 'Liquified Petroleum Gas (LPG) - Consumption by machinery',
 'Liquified Petroleum Gas (LPG) - Consumption by mining and quarrying',
 'Liquified Petroleum Gas (LPG) - Consumption by non-ferrous metals',
 'Liquified Petroleum Gas (LPG) - Consumption by non-metallic minerals',
 'Liquified Petroleum Gas (LPG) - Consumption by paper, pulp and print',
 'Liquified Petroleum Gas (LPG) - Consumption by textile and leather',
 'Liquified Petroleum Gas (LPG) - Consumption by transport equipment',
 'Liquified Petroleum Gas (LPG) - Consumption by wood and wood products',
 'Liquified Petroleum Gas (LPG) - Final energy consumption',
 'Liquified Petroleum Gas (LPG) - Transformation in CHP plants - autoproducers',
 'Liquified Petroleum Gas (LPG) - Transformation in CHP plants - main activity producers',
 'Liquified Petroleum Gas (LPG) - Transformation in petrochemical plants',
 'Lubricants - Exports',
 'Lubricants - Final consumption',
 'Lubricants - Imports',
 'Lubricants - Non-energy uses',
 'Lubricants - Production',
 'Lubricants - production from refineries',
 'Lubricants - Stock changes',
 'Lubricants - Total energy supply',
 'Lubricants - Transfers and recycled products',
 'Motor Gasoline - Consumption by chemical and petrochemical',
 'Motor Gasoline - Consumption by commerce and public services',
 'Motor Gasoline - Consumption by industries not elsewhere specified',
 'Motor Gasoline - Consumption by manufacturing, construction and non-fuel mining industry',
 'Motor Gasoline - Consumption by other',
 'Motor Gasoline - Consumption by other manuf., const. and non-fuel min. ind.',
 'Motor Gasoline - Consumption by other transportation',
 'Motor Gasoline - Consumption by transport',
 'Motor Gasoline - Consumption in agriculture, forestry and fishing',
 'Motor Gasoline - Consumption in road',
 'Motor Gasoline - Exports',
 'Motor Gasoline - Final consumption',
 'Motor Gasoline - Final energy consumption',
 'Motor Gasoline - Imports',
 'Motor Gasoline - Production',
 'Motor Gasoline - production from plants',
 'Motor Gasoline - production from refineries',
 'Motor Gasoline - Receipts from other sources',
 'Motor Gasoline - Stock changes',
 'Motor Gasoline - Total energy supply',
 'Motor Gasoline - Transfers and recycled products',
 'Municipal Wastes - Energy industries own use',
 'Municipal Wastes - Own use by electricity, heat and CHP plants',
 'Municipal Wastes - Production',
 'Municipal wastes - Total energy supply',
 'Municipal Wastes - Transformation',
 'Municipal Wastes - Transformation in CHP plants - autoproducers',
 'Municipal Wastes - Transformation in electricity, CHP and heat plants',
 'Municipal Wastes - Transformation in electricity plants - autoproducers',
 'Municipal Wastes - Transformation in electricity plants - main activity producers',
 'Naphtha - Energy industries own use',
 'Naphtha - Exports',
 'Naphtha - Final consumption',
 'Naphtha - Imports',
 'Naphtha - Non-energy uses',
 'Naphtha - Own use by oil refineries',
 'Naphtha - Production',
 'Naphtha - production from refineries',
 'Naphtha - Stock changes',
 'Naphtha - Total energy supply',
 'Naphtha - Transfers and recycled products',
 'Naphtha - Transformation',
 'Naphtha - Transformation in gas works',
 'Naphtha - Transformation in petrochemical plants',
 'Natural gas (including LNG) - consumption by chemical and petrochemical',
 'Natural Gas (including LNG) - consumption by commerce and public services',
 'Natural Gas (including LNG) - consumption by construction',
 'Natural Gas (including LNG) - consumption by food and tobacco',
 'Natural gas (including LNG) - consumption by households',
 'Natural Gas (including LNG) - consumption by industries not elsewhere specified',
 'Natural gas (including LNG) - consumption by iron and steel',
 'Natural Gas (including LNG) - consumption by machinery',
 'Natural gas (including LNG) - consumption by manufacturing, construction and non-fuel industry',
 'Natural Gas (including LNG) - consumption by mining and quarrying',
 'Natural Gas (including LNG) - consumption by non-ferrous metals',
 'Natural Gas (including LNG) - consumption by non-metallic minerals',
 'Natural gas (including LNG) - consumption by other',
 'Natural gas (including LNG) - consumption by other manuf., const. and non-fuel ind.',
 'Natural Gas (including LNG) - consumption by paper, pulp and print',
 'Natural Gas (including LNG) - consumption by textile and leather',
 'Natural gas (including LNG) - consumption by transport',
 'Natural Gas (including LNG) - consumption by transport equipment',
 'Natural Gas (including LNG) - consumption by wood and wood products',
 'Natural gas (including LNG) - consumption in agriculture, forestry and fishing',
 'Natural gas (including LNG) - consumption in road',
 'Natural gas (including LNG) - consumption not elsewhere specified (other)',
 'Natural gas (including LNG) - consumption not elsewhere specified (transport)',
 'Natural gas (including LNG) - energy industries own use',
 'Natural gas (including LNG) - exports',
 'Natural gas (including LNG) - extraction loss shrinkage',
 'Natural gas (including LNG) - final consumption',
 'Natural Gas (including LNG) - final energy consumption',
 'Natural gas (including LNG) - Flared',
 'Natural gas (including LNG) - flared and vented',
 'Natural gas (including LNG) - imports',
 'Natural gas (including LNG) - losses',
 'Natural gas (including LNG) - Memo:Gross production',
 'Natural gas (including LNG) - non-energy uses',
 'Natural gas (including LNG) - other energy industry own use',
 'Natural gas (including LNG) - own use by coal mines',
 'Natural gas (including LNG) - own use by coke ovens',
 'Natural gas (including LNG) - own use by electricity, heat and CHP plants',
 'Natural gas (including LNG) - own use by oil and gas extraction',
 'Natural gas (including LNG) - own use by oil refineries',
 'Natural gas (including LNG) - production',
 'Natural gas (including LNG) - stock changes',
 'Natural gas (including LNG) - total energy supply',
 'Natural gas (including LNG) - total resources',
 'Natural gas (including LNG) - transformation',
 'Natural Gas (including LNG) - transformation in CHP plants - autoproducers',
 'Natural gas (including LNG) - transformation in electricity, CHP and heat plants',
 'Natural Gas (including LNG) - transformation in electricity plants - autoproducers',
 'Natural Gas (including LNG) - transformation in electricity plants - main activity producers',
 'Natural gas (including LNG) - transformation in gas works',
 'Natural gas liquids - Other transformation',
 'Natural gas liquids - Production',
 'Natural gas liquids - Total energy supply',
 'Natural gas liquids - Transfers and recycled products',
 'Natural gas liquids - Transformation',
 'Electricity - total nuclear production',
 'Of which: biodiesel - Consumption by agriculture, forestry and fishing',
 'Of which: biodiesel - Consumption by commerce and public services',
 'Of which: biodiesel - Consumption by construction ',
 'Of which: biodiesel - Consumption by food and tobacco ',
 'Of which: biodiesel - Consumption by households',
 'Of which: biodiesel - Consumption by manufacturing, construction and non-fuel mining industry',
 'Of which: biodiesel - Consumption by mining and quarrying ',
 'Of which: biodiesel - Consumption by other',
 'Of which: biodiesel - Consumption by other manufacturing, construction and non-fuel mining industry',
 'Of which: biodiesel - Consumption by road',
 'Of which: biodiesel - Consumption in transport',
 'Of which: biodiesel - Consumption not elsewhere specified (transport)',
 'Of which: biodiesel - Final consumption',
 'Of which: biodiesel - Final energy consumption',
 'Of which: biodiesel - Imports',
 'Of which: biodiesel - Receipts from other sources',
 'Of which: biodiesel - Stock changes',
 'Of which: biodiesel - Total energy supply',
 'Of which: biogasoline - Consumption by agriculture, forestry and fishing',
 'Of which: biogasoline - Consumption by commerce and public services',
 'Of which: biogasoline - Consumption by other',
 'Of which: biogasoline - Consumption by road',
 'Of which: biogasoline - Consumption in transport',
 'Of which: biogasoline - Consumption not elsewhere specified (transport)',
 'Of which: biogasoline - Final consumption',
 'Of which: biogasoline - Final energy consumption',
 'Of which: biogasoline - Receipts from other sources',
 'Of which: biogasoline - Total energy supply',
 'Other bituminous coal - consumption by chemical and petrochemical industry',
 'Other bituminous coal - consumption by food and tobacco industry',
 'Other bituminous coal - consumption by households',
 'Other bituminous coal - consumption by iron and steel industry',
 'Other bituminous coal - consumption by machinery industry',
 'Other bituminous coal - consumption by manufacturing, construction and non-fuel industry',
 'Other bituminous coal - consumption by mining and quarrying industry',
 'Other bituminous coal - consumption by non-ferrous metals industry',
 'Other bituminous coal - consumption by non-metallic minerals',
 'Other bituminous coal - consumption by other',
 'Other bituminous coal - consumption by other manuf., const. and non-fuel ind.',
 'Other bituminous coal - consumption by paper, pulp and print',
 'Other bituminous coal - consumption in commerce and public services',
 'Other bituminous coal - consumption not elsewhere specified (industry)',
 'Other bituminous coal - consumption not elsewhere specified (other)',
 'Other bituminous coal - energy industries own use',
 'Other bituminous coal - exports',
 'Other bituminous coal - final consumption',
 'Other bituminous coal - final energy consumption',
 'Other bituminous coal - imports',
 'Other bituminous coal - other energy industry own use',
 'Other bituminous coal - own use by coal mines',
 'Other bituminous coal - production',
 'Other bituminous coal - receipts from other sources',
 'Other bituminous coal - stock changes',
 'Other bituminous coal - total energy supply',
 'Other bituminous coal - transformation',
 'Other bituminous coal - transformation in autoproducer CHP plants',
 'Other bituminous coal - transformation in autoproducer electricity plants',
 'Other bituminous coal - transformation in blast furnaces',
 'Other bituminous coal - transformation in briquetting plants',
 'Other bituminous coal - transformation in coke ovens',
 'Other bituminous coal - Transformation in electricity, CHP and heat plants',
 'Other bituminous coal - transformation in main activity producer electricity plants',
 'Other kerosene - Consumption by other',
 'Other kerosene - Consumption in agriculture, forestry and fishing',
 'Other kerosene - Exports',
 'Other kerosene - Final consumption',
 'Other kerosene - Final energy consumption',
 'Other kerosene - Imports',
 'Other kerosene - Production',
 'Other kerosene - production from refineries',
 'Other kerosene - Stock changes',
 'Other kerosene - Total energy supply',
 'Other kerosene - Transfers and recycled products',
 'Other oil products n.e.c. - Energy industries own use',
 'Other oil products n.e.c. - Exports',
 'Other oil products n.e.c. - Final consumption',
 'Other oil products n.e.c. - Imports',
 'Other oil products n.e.c. - International marine bunkers',
 'Other oil products n.e.c. - Non-energy uses',
 'Other oil products n.e.c. - Other energy industry own use',
 'Other oil products n.e.c. - Own use by oil refineries',
 'Other oil products n.e.c. - Production',
 'Other oil products n.e.c. - production from refineries',
 'Other oil products n.e.c. - Stock changes',
 'Other oil products n.e.c. - Total energy supply',
 'Other oil products n.e.c. - Transfers and recycled products',
 'Vegetal waste - Consumption by agriculture, forestry and fishing',
 'Vegetal waste - Consumption by commerce and public services',
 'Vegetal waste - Consumption by households',
 'Vegetal waste - Consumption by manufacturing, construction and non-fuel mining industry',
 'Vegetal waste - Consumption by other',
 'Vegetal waste - Consumption by other manufacturing, construction and non-fuel mining industry',
 'Vegetal waste - Consumption not elsewhere specified (other)',
 'Vegetal waste - Energy industries own use',
 'Vegetal waste - Final consumption',
 'Vegetal waste - Final energy consumption',
 'Vegetal waste - Own use by electricity, heat and CHP plants',
 'Vegetal waste - Production',
 'Vegetal waste - Total energy supply',
 'Vegetal waste - Transformation',
 'Vegetal waste - Transformation in CHP plants - autoproducers',
 'Vegetal waste - Transformation in electricity, CHP and heat plants',
 'Vegetal waste - Transformation in electricity plants - autoproducers',
 'Vegetal waste - Transformation in electricity plants - main activity producers',
 'Paraffin waxes - Exports',
 'Paraffin waxes - Final consumption',
 'Paraffin waxes - Imports',
 'Paraffin waxes - Non-energy uses',
 'Paraffin waxes - Production',
 'Paraffin waxes - production from refineries',
 'Paraffin waxes - Stock changes',
 'Paraffin waxes - Total energy supply',
 'Paraffin waxes - Transfers and recycled products',
 'Patent fuel - consumption by households',
 'Patent fuel - Consumption by other',
 'Patent fuel - Final consumption',
 'Patent fuel - Final energy consumption',
 'Patent fuel - production',
 'Patent fuel - Total energy supply',
 'Peat (for fuel use) - recoverable',
 'Peat (for fuel use) - total known reserves',
 'Peat (for fuel use) - total resources in place',
 'Petroleum coke - consumption by chemical and petrochemical',
 'Petroleum Coke - Consumption by commerce and public services',
 'Petroleum coke - Consumption by households',
 'Petroleum coke - Consumption by iron and steel',
 'Petroleum Coke - Consumption by machinery ',
 'Petroleum coke - Consumption by manufacturing, construction and non-fuel mining industry',
 'Petroleum Coke - Consumption by non-metallic minerals ',
 'Petroleum coke - Consumption by other',
 'Petroleum coke - Consumption by other manuf., const. and non-fuel min. ind.',
 'Petroleum coke - Energy industries own use',
 'Petroleum coke - Exports',
 'Petroleum coke - final consumption',
 'Petroleum Coke - Final energy consumption',
 'Petroleum coke - Imports',
 'Petroleum coke - Non-energy uses',
 'Petroleum coke - Own use by blast furnaces',
 'Petroleum coke - Own use by oil refineries',
 'Petroleum coke - Production',
 'Petroleum coke - production from refineries',
 'Petroleum coke - Stock changes',
 'Petroleum coke - Total energy supply',
 'Petroleum coke - Transfers and recycled products',
 'Petroleum coke - Transformation',
 'Petroleum Coke - Transformation in CHP plants - autoproducers',
 'Petroleum coke - Transformation in electricity, CHP and heat plants',
 'Petroleum Coke - Transformation in electricity plants - main activity producers',
 'Feedstocks - exports',
 'Feedstocks - imports',
 'Feedstocks - Receipts from other sources',
 'Feedstocks - stock changes',
 'Feedstocks - total energy supply',
 'Feedstocks - transfers and recycled products',
 'Feedstocks - transformation',
 'Feedstocks - transformation in oil refineries',
 'Refinery gas - consumption by chemical and petrochemical',
 'Refinery gas - consumption by manufacturing, construction and non-fuel mining industry',
 'Refinery gas - Energy industries own use',
 'Refinery gas - Final consumption',
 'Refinery Gas - Final energy consumption',
 'Refinery gas - Losses',
 'Refinery gas - Own use by oil refineries',
 'Refinery gas - Production',
 'Refinery gas - Production from refineries',
 'Refinery gas - Total energy supply',
 'Refinery gas - Transfers and recycled products',
 'Refinery gas - Transformation',
 'Refinery Gas - Transformation in CHP plants - autoproducers',
 'Refinery gas - Transformation in electricity, CHP and heat plants',
 'Refinery Gas - Transformation in petrochemical plants',
 'Electricity - total solar production',
 'Sub-bituminous coal - Consumption by agriculture, forestry and fishing',
 'Sub-bituminous coal - Consumption by chemical industry',
 'Sub-bituminous coal - Consumption by coal mines',
 'Sub-bituminous coal - Consumption by commerce and public services',
 'Sub-bituminous coal - Consumption by energy sector',
 'Sub-bituminous coal - Consumption by households',
 'Sub-bituminous coal - Consumption by manufacturing, construction and non-fuel industry',
 'Sub-bituminous coal - Consumption by non-metallic minerals industry',
 'Sub-bituminous coal - Consumption by other',
 'Sub-bituminous coal - Consumption by other manuf., const. and non-fuel ind.',
 'Sub-bituminous coal - Consumption by paper, pulp and print',
 'Sub-bituminous coal - Consumption not elsewhere specified (industry)',
 'Sub-bituminous coal - Final consumption',
 'Sub-bituminous coal - Final energy consumption',
 'Sub-bituminous coal - Imports',
 'Sub-bituminous coal - Production',
 'Sub-bituminous coal - Stock changes',
 'Sub-bituminous coal - Total energy supply',
 'Sub-bituminous coal - Transformation',
 'Sub-bituminous coal - Transformation in electricity, CHP and heat plants',
 'Sub-bituminous coal - Transformation in main activity electricity plants',
 'Electricity - total thermal production',
 'Electricity - Consumption by chemical and petrochemical',
 'Electricity - Consumption by commercial and public services',
 'Electricity - Consumption by construction',
 'Electricity - Consumption by food and tobacco',
 'Electricity - Consumption by households',
 'Electricity - Consumption by iron and steel',
 'Electricity - Consumption by machinery',
 'Electricity - Consumption by manufacturing, construction and non-fuel industry',
 'Electricity - Consumption by mining and quarrying',
 'Electricity - Consumption by non-ferrous metals',
 'Electricity - Consumption by non-metallic minerals',
 'Electricity - Consumption by other',
 'Electricity - Consumption by other manuf., const. and non-fuel ind.',
 'Electricity - Consumption by paper, pulp and print',
 'Electricity - Consumption by rail',
 'Electricity - Consumption by textile and leather',
 'Electricity - Consumption by transport',
 'Electricity - Consumption by transport equipment',
 'Electricity - Consumption by wood and wood products',
 'Electricity - Consumption in agriculture, forestry and fishing',
 'Electricity - Consumption not elsewhere specified (industry)',
 'Electricity - Consumption not elsewhere specified (other)',
 'Electricity - Consumption not elsewhere specified (transport)',
 'Electricity - Energy industries own use',
 'Electricity - exports',
 'Electricity - Final energy consumption',
 'Electricity - Gross demand',
 'Electricity - Gross production',
 'Electricity - imports',
 'Electricity - Losses',
 'Electricity - net production',
 'Electricity - Other energy industry own use',
 'Electricity - Own use by coal mines',
 'Electricity - Own use by coke ovens',
 'Electricity - Own use by electricity, heat and CHP plants',
 'Electricity - Own use by gas works',
 'Electricity - Own use by nuclear fuel extraction and processing',
 'Electricity - Own use by oil and gas extraction',
 'Electricity - Own use by oil refineries',
 'Electricity - Own use by pump-storage plants',
 'Electricity - total production, autoproducer',
 'Electricity - total production, main activity',
 'From combustible fuels – Autoproducer',
 'From combustible fuels – Autoproducer – CHP plants',
 'From combustible fuels – Autoproducer – Electricity plants',
 'From combustible fuels – Main activity – Electricity plants',
 'From other sources – Autoproducer',
 'From other sources – Autoproducer – CHP plants',
 'From other sources – Autoproducer – Electricity plants',
 'Hydro – Autoproducer',
 'Hydro – Main activity',
 'Nuclear – Main activity',
 'Nuclear – Main activity – Electricity plants',
 'Of which: Pumped hydro – Main activity',
 'Solar – Autoproducer',
 'Solar – Main activity',
 'Solar photovoltaic – Autoproducer',
 'Solar photovoltaic – Main activity',
 'Solar thermal – Main activity',
 'Wind – Autoproducer',
 'Wind – Main activity',
 'Total refinery output',
 'Total refinery throughput',
 'Uranium - estimated additional reserves',
 'Uranium - production',
 'Uranium - reasonably assured reserves',
 'White spirit and special boiling point industrial spirits - Exports',
 'White spirit and special boiling point industrial spirits - final consumption',
 'White spirit and special boiling point industrial spirits - Imports',
 'White spirit and special boiling point industrial spirits - Non-energy uses',
 'White spirit and special boiling point industrial spirits - Production',
 'White spirit and special boiling point industrial spirits - production from refineries',
 'White spirit and special boiling point industrial spirits - Stock changes',
 'White spirit and special boiling point industrial spirits - Total energy supply',
 'White spirit and special boiling point industrial spirits - Transfers and recycled products',
 'Electricity - total wind production']

However, it is difficult to analyze the products and the energy flow if we have them in a single column. For this reason, we can separate this column in product and energy_flow

spain_energy_df[["energy_product", "energy_flow"]] = spain_energy_df.commodity_transaction.str.split(" - ",1,expand=True)
spain_energy_df

Once the column is separated in 2, we can remove commodity_transaction

spain_energy_df = spain_energy_df.drop(["commodity_transaction"], axis=1)

Cleaning energy_flow column

# all in lower cases
for i in range(0, spain_energy_df.shape[0]):
    if spain_energy_df.iloc[i,7] != None:
        spain_energy_df.iloc[i,7] = spain_energy_df.iloc[i,7].lower()

for i in range(0, spain_energy_df.shape[0]):
    if spain_energy_df.iloc[i,7] == "total wind production" or spain_energy_df.iloc[i,7] == "total thermal production" or spain_energy_df.iloc[i,7] == "total solar production" or spain_energy_df.iloc[i,7] == "total hydro production":
        spain_energy_df.iloc[i,7] = "production"
        
spain_energy_df

Moreover, we are removing the columns quantity_footnotes and country_or_area

spain_energy_df = spain_energy_df.drop(["quantity_footnotes"], axis=1)
spain_energy_df = spain_energy_df.drop(["country_or_area"], axis=1)
spain_energy_df = spain_energy_df.reset_index(drop=True)
spain_energy_df

If we want to analyze the evolution of energy consumption and production, it could be interesting to know the first and the last year of data register

first_year = min(spain_energy_df.year)
last_year = max(spain_energy_df.year)
print("The dataset contains data from {} to {}".format(first_year, last_year))
The dataset contains data from 1990 to 2014

We also are checking which measurement units are included in the dataset

spain_energy_df.unit.unique().tolist()
['Metric tons,  thousand',
 'Terajoules',
 'Kilowatts,  thousand',
 'Kilowatt-hours, million',
 'Cubic metres, thousand',
 'Metric Tons']

We can convert from Metric tons -> Metric tons, thousand, and Terajoules -> Kilowatt-hours, million -> Gigawatt-hours

for i in range(0, spain_energy_df.shape[0]):
    if spain_energy_df.iloc[i,1] == "Kilowatt-hours, million": # 1000000 KWh = 1 GWh
        spain_energy_df.iloc[i,1] = "Gigawatt-hours"
    elif spain_energy_df.iloc[i,1] == "Terajoules":
        spain_energy_df.iloc[i,2] = spain_energy_df.iloc[i,2] * 0.277 
        spain_energy_df.iloc[i,1] = "Gigawatt-hours"
    elif spain_energy_df.iloc[i,1] == "Metric Tons":
        spain_energy_df.iloc[i,2] = spain_energy_df.iloc[i,2] / 1000
        spain_energy_df.iloc[i,1] = "Metric tons,  thousand"

spain_energy_df.unit.unique().tolist()
['Metric tons,  thousand',
 'Gigawatt-hours',
 'Kilowatts,  thousand',
 'Cubic metres, thousand']

Preparing data

Once we have cleaned the dataset, we are going to prepare the data for the exploratory analysis. To perform the analysis, it is necessaire to:

  1. Get energy production, with special interest in electricity production
  2. Tag the renewable energy and conventional energy
  3. Compute the excess energy
  4. Get energy consumption by years

Get energy production

total_electricity_spain_df = spain_energy_df[spain_energy_df.category == "total_electricity"]

# Get electricity production (energy_flow = NaN)
electricity_production_df = total_electricity_spain_df[total_electricity_spain_df.energy_flow.isna()]

# Split 
electricity_production_df[["energy_type", "producer"]] = electricity_production_df.energy_product.str.split(" – ",1,expand=True)
electricity_production_df

# Remove columns
electricity_production_df = electricity_production_df.drop(["energy_product"], axis=1)
electricity_production_df = electricity_production_df.drop(["energy_flow"], axis=1)
electricity_production_df = electricity_production_df.drop(["category"], axis=1)
# Get separate dataframes
main_electricity_production_df = electricity_production_df[electricity_production_df.producer == "Main activity"]
auto_electricity_production_df = electricity_production_df[electricity_production_df.producer == "Autoproducer"]

Get 2014 productions

electricity_production_2014_df = electricity_production_df[electricity_production_df.year == 2014]
main_electricity_production_2014_df = main_electricity_production_df[electricity_production_df.year == 2014]
auto_electricity_production_2014_df = auto_electricity_production_df[electricity_production_df.year == 2014]

# Get big-scale energy production
total_main_electricity_production_2014 = float(total_electricity_spain_df[(total_electricity_spain_df.year == 2014) & (total_electricity_spain_df.energy_flow == "total production, main activity")]["quantity"])
# Get autoconsumption energy production
total_auto_electricity_production_2014 = float(total_electricity_spain_df[(total_electricity_spain_df.year == 2014) & (total_electricity_spain_df.energy_flow == "total production, autoproducer")]["quantity"])

# Normalize to get percentage
for i in range(0, main_electricity_production_2014_df.shape[0]):
    main_electricity_production_2014_df.iloc[i, 2] = main_electricity_production_2014_df.iloc[i, 2] / total_main_electricity_production_2014
    

Get 1990 production

electricity_production_1990_df = electricity_production_df[electricity_production_df.year == 1990]
main_electricity_production_1990_df = main_electricity_production_df[electricity_production_df.year == 1990]
auto_electricity_production_1990_df = auto_electricity_production_df[electricity_production_df.year == 1990]

# Get big-scale energy production
total_main_electricity_production_1990 = float(total_electricity_spain_df[(total_electricity_spain_df.year == 1990) & (total_electricity_spain_df.energy_flow == "total production, main activity")]["quantity"])
# Get autoconsumption energy production
total_auto_electricity_production_1990 = float(total_electricity_spain_df[(total_electricity_spain_df.year == 1990) & (total_electricity_spain_df.energy_flow == "total production, autoproducer")]["quantity"])

# Normalize to get percentage
for i in range(0, main_electricity_production_1990_df.shape[0]):
    main_electricity_production_1990_df.iloc[i, 2] = main_electricity_production_1990_df.iloc[i, 2] / total_main_electricity_production_1990

Energy consumption along years

total_energy_consumption_df = total_electricity_spain_df[total_electricity_spain_df.energy_flow == "final energy consumption"]
total_net_production_df = total_electricity_spain_df[total_electricity_spain_df.energy_flow == "net production"]
production_vs_consumption_df = pd.concat([total_energy_consumption_df, total_net_production_df], axis = 0)

Excess energy

diff_energy_df = pd.DataFrame(columns = ["year", "energy_diff"])
diff_energy_df.year = total_energy_consumption_df.year
diff_energy_df.energy_diff = total_net_production_df.quantity.to_numpy() - total_energy_consumption_df.quantity.to_numpy()
    

Tag renewable and conventional energy.

Definitions:

  • Conventional: limited energy sources. There are 2 categories: energy taken from combustible fuels and nuclear energy
  • Renewable: energy sources that are unlimited in nature (they are inexhaustible or their regeneration are rapid)
renewable_list = ["Hydro", "Of which: Pumped hydro", "Solar", "Solar photovoltaic", "Solar thermal", "Wind"]
conventional_list = ["From combustible fuels", "Nuclear"]

electricity_production_df["energy_group"] = None
for i in range(0, electricity_production_df.shape[0]):
    if electricity_production_df.energy_type.iloc[i] in renewable_list:
        electricity_production_df.energy_group.iloc[i] = "Renewable"
    elif electricity_production_df.energy_type.iloc[i] in conventional_list:
        electricity_production_df.energy_group.iloc[i] = "Conventional"
conventional_energy_df = electricity_production_df[electricity_production_df.energy_group == "Conventional"]
renewable_energy_df = electricity_production_df[electricity_production_df.energy_group == "Renewable"]

Exploratory Analysis and Visualization

In this section, we're going to explore the data by plotting different graphs. Specifically, we are exploring:

  1. Net production and consumption in Spain
  2. The energy excess (production - consumption)
  3. Evolution of the big scale electricity generation sources
  4. The energy production with conventional and renewable energy

Let's begin by importing matplotlib.pyplot and seaborn.

import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt

sns.set_style('darkgrid')
matplotlib.rcParams['font.size'] = 14
matplotlib.rcParams['figure.figsize'] = (25, 10)

Next bar plot shows the evolution of net production and consumption in Spain. From 1990, we see an increase of demand and production. However, it seems that both of them are lowing gradually from 2008.

sns.barplot(x="year", y = "quantity", hue="energy_flow", data=production_vs_consumption_df);
plt.title("Energy consumption and net production in Spain (1990-2014)");
plt.xlabel("Year");
plt.ylabel("Value in GWh");
Notebook Image

In the previous chart, we can see a difference between production and consumption. If we plot this difference, we can see that the energy excess grew from 1990 to 2008.

plt.plot(diff_energy_df.year, diff_energy_df.energy_diff, 'r-x', linewidth=4, markersize=12, markeredgewidth=4, markeredgecolor='navy');
plt.xticks(diff_energy_df.year);
plt.xlabel("Year");
plt.ylabel("Difference value in GWh");
plt.title("Energy excess (Net production - Consumption)");
Notebook Image

In addition, we could analyze the influence of global warming and the policies to stop them in energy production. If we represent conventional production and renewable energy production, we will see that conventional production is getting low, while renewable energy usage is growing.

conventional_production_df = electricity_production_df[electricity_production_df.energy_group == "Conventional"].groupby(["year", "energy_group"], as_index=False).sum()
renewable_production_df = electricity_production_df[electricity_production_df.energy_group == "Renewable"].groupby(["year", "energy_group"], as_index=False).sum()
conventional_vs_renewable_df = pd.concat([conventional_production_df, renewable_production_df], axis = 0).reset_index(drop=True)
# sns.barplot(x="year", y="quantity", hue="energy_group", data=conventional_vs_renewable_df);
sns.barplot(x="year", y="quantity", data=conventional_production_df, color="darkblue");
sns.barplot(x="year", y="quantity", data=renewable_production_df, color = "lightblue");

top_bar = matplotlib.patches.Patch(color='darkblue', label="Conventional")
bottom_bar = matplotlib.patches.Patch(color='lightblue', label="Renewable")
plt.legend(handles=[top_bar, bottom_bar]);
plt.xlabel("Year");
plt.ylabel("Energy production in GWh");
plt.title("Conventional and renewable energy production in Spain (1990-2014)");
Notebook Image

Moreover, to understand the evolution of energy production, we can represent the production distribution in 1990 and 2014. The pie chart shows a reduction of combustible fuels and nuclear energy production, while solar and eolic energy has a greater impact.

fig, axs = plt.subplots(1,2)
fig.set_size_inches(25,10)
axs[0].pie(main_electricity_production_1990_df.quantity)
axs[0].legend(main_electricity_production_1990_df.energy_type)
axs[0].set_title("Energy production in 1990")

axs[1].pie(main_electricity_production_2014_df.quantity)
axs[1].legend(main_electricity_production_2014_df.energy_type)
axs[1].set_title("Energy production in 2014");
Notebook Image

Asking and Answering Questions


Q1: Which is the year with the highest quantity of exported energy? And the highest importation year?
imports_df = total_electricity_spain_df[total_electricity_spain_df.energy_flow == "imports"]
max_importation_year = imports_df[imports_df.quantity == max(imports_df.quantity)].year
print("The highest amount of energy importated in Spain was in {}".format(int(max_importation_year)))
The highest amount of energy importated in Spain was in 2002
exports_df = total_electricity_spain_df[total_electricity_spain_df.energy_flow == "exports"]
max_exportation_year = exports_df[exports_df.quantity == max(exports_df.quantity)].year
print("The highest amount of energy exportated in Spain was in {}".format(int(max_exportation_year)))
The highest amount of energy exportated in Spain was in 2012
# Plot evolution
plt.plot(imports_df.year, imports_df.quantity, "b-o", linewidth = 3, markersize=10);
plt.plot(exports_df.year, exports_df.quantity, "r-o", linewidth = 3, markersize=10);
plt.legend(labels=["Imported energy", "Exported energy"]);
plt.xticks(imports_df.year);
plt.title("Evolution of the imported & exported energy in Spain (GWh)");
plt.xlabel("Year");
plt.ylabel("Energy (GWh)");
Notebook Image
Q2: Due to energy transportation, we can't take profit from all the energy produced. Which is the year with the largest losses? And the year with the lowest losses?
losses_df = total_electricity_spain_df[total_electricity_spain_df.energy_flow == "losses"]
max_losses_year = losses_df[losses_df.quantity == max(losses_df.quantity)].year
print("{} was the year whith the highest energy losses in Spain".format(int(max_losses_year)))
2010 was the year whith the highest energy losses in Spain
min_losses_year = losses_df[losses_df.quantity == min(losses_df.quantity)].year
print("{} was the year whith the lowest energy losses in Spain".format(int(min_losses_year)))
1990 was the year whith the lowest energy losses in Spain
sns.barplot(x="year", y="quantity", data=losses_df, color="orange");
plt.xlabel("Year");
plt.ylabel("Energy losses in GWh");
plt.title("Energy losses from 1990 to 2014");
Notebook Image
Q3: We can divide the losses by the net production to know how much energy is lossed per GWh produced. This index, shows the same results as the losses?
# Get normalized losses to net production
index_losses = losses_df.quantity.to_numpy() / total_net_production_df.quantity.to_numpy()

years = losses_df.year.tolist()
losses_graph = pd.DataFrame(index = ["net losses", "normalized losses"], columns=years)
for i in range(0, len(years)):
    losses_graph.iloc[0, i] = int(losses_df[losses_df.year == years[i]].quantity)
    losses_graph.iloc[1, i] = index_losses[i]

# Normalize by maximum in the row
losses_graph.loc["net losses"] = losses_graph.loc["net losses"] / max(losses_graph.loc["net losses"])
losses_graph.loc["normalized losses"] = losses_graph.loc["normalized losses"] / max(losses_graph.loc["normalized losses"])

losses_graph = losses_graph[losses_graph.columns].astype(float)
sns.heatmap(losses_graph, annot=True, cmap='Blues');
Notebook Image

If we compare the net losses we could conclude that 1990 was the best year in therms of losses (lowest). However, this conclusion is not correct: Spain had lower energy losses because production was also low.

Q4: Which is the year with the highest quantity of renewable energy produced?
total_renewable_production = renewable_energy_df.groupby("year").sum()
max_ren_prod_year = total_renewable_production[total_renewable_production.quantity == max(total_renewable_production.quantity)]
print("The largest renewable energy production war registered in the year {}".format(max_ren_prod_year.index[0]))
The largest renewable energy production war registered in the year 2013
Q5: In Spain, what kind of renewable energy has had the biggest development (big scale production)?
# Main activity
for e in renewable_energy_df.energy_type.unique().tolist():
    energy = renewable_energy_df[(renewable_energy_df.energy_type == e) & (renewable_energy_df.producer == "Main activity")]
    plt.plot(energy.year, energy.quantity, "-o", linewidth=3, markersize=10)

plt.legend(labels=renewable_energy_df.energy_type.unique().tolist());
plt.xticks(renewable_energy_df.year.unique().tolist());
plt.title("Evolution of the renewable energy production in Spain (GWh)");
plt.xlabel("Year");
plt.ylabel("Energy (GWh)");
Notebook Image

If we attend to the previous graph, we can see that eolic energy has had a great development in Spain from 1990.

Q5: In energetic therms, what is the most demandant industry? Analyze the evolution from 1990 to 2014
# Remove non industry rows of the dataframe
non_industry_consumption_list = ["imports", "exports", "losses", "net production", "final energy consumption", "gross demand", "gross production", "total production, autoproducer", "total production, main activity"]
industry_consumption_df = total_electricity_spain_df

for i in non_industry_consumption_list:
    industry_consumption_df = industry_consumption_df.loc[industry_consumption_df.energy_flow != i]

industry_consumption_df = industry_consumption_df.dropna()

# Construct a dataframe where rows are the consumption sectors and the columns are the years
industries_list = industry_consumption_df.energy_flow.unique().tolist()
years_list = industry_consumption_df.year.unique().tolist()
years_list.sort()
industry_map = pd.DataFrame(index=industries_list, columns=years_list)
industry_map.index.name = "industry"

for ind in industries_list:
    for y in years_list:
        data = industry_consumption_df[(industry_consumption_df.year == y) & (industry_consumption_df.energy_flow == ind)].quantity.to_numpy()
        if data.size == 0:
            data = int(0)
        
        industry_map.loc[ind, y] = int(data)

# heatmap
industry_map = industry_map[industry_map.columns].astype(float)

fig = plt.figure(figsize=[15,10])
sns.heatmap(industry_map, cmap='Blues');
plt.title("Energy consumption by industries/tasks");