Oil Movements and Energy Consumption Insights - Using Python, Pandas, Matplotlib and Bokeh

By Younes Soliman

The fuel tankers war happening mostly for those moving along strait of Hormuz raises several questions about what could be the effect of those activities and the increasing risk on the fuel prices around the world. Some of the questions are:

  • What is the quantity of Oil movements between areas, and what specifically is the amount passing through the risky area.
  • Does Oil form a big percentage of the needed energy for consumption by the world.
  • How much is the total world energy consumption and how the amount/type of energy changed over years
  • Is the global energy consumption increasing? and what are the top energy consuming countries?
  • Calculate the energy consumption per country per person to see what countries should put plans for their energy use.

I will try to answer the above questions using python data science and presentation libraries.

Let's not talk more, and let's dig deeper and catch python by our hands. I will not show the full code in order not to make you bored, but few explanations about the output

So first of all I will show a data sample of the crude oil movements from one area to another. The amount is in million tonnes. I will not take into account here the oil products movements.

Notes: Does not include biofuels trade. Bunker fuel use is not included as exports. Intra-area movements (for example, between countries within Europe) are excluded.

In [2]:
#Import needed libraries
import numpy as np
import pandas as pd
#Import plotting libraries and initialize params

import matplotlib.pyplot as plt

The first column contains the areas from which the crude oil is going, while the other columns show the area to where the oil is going. The total amount is about 2263 million tonnes in year 2018.

In [4]:
 
Out[4]:
From \ To (Crude (million tonnes)) Canada Mexico US S. & Cent. America Europe Russia Other CIS Middle East Africa Australasia China India Japan Singapore Other Asia Pacific Total
0 Canada 0.00 0.00 183.95 0.60 4.45 0.00 0.00 0.00 0.00 0.00 1.22 0.46 0.00 0.00 0.25 190.94
1 Mexico 0.00 0.00 33.12 0.49 11.98 0.00 0.00 0.08 0.00 0.00 0.71 8.88 1.81 0.00 4.62 61.69
2 US 18.83 0.14 0.00 5.40 29.23 0.00 0.00 1.54 0.00 0.25 12.28 4.86 2.45 1.12 17.12 93.23
3 S. & Cent. America 0.35 0.00 56.90 0.00 10.22 0.00 0.00 0.00 0.35 0.00 61.99 22.91 1.90 0.18 1.90 156.69
4 Europe 1.44 0.00 5.89 0.82 0.00 0.00 0.00 6.06 0.37 0.00 8.62 1.52 0.00 0.01 6.50 31.23
5 Russia 0.20 0.00 3.64 3.64 153.25 0.00 18.47 1.43 0.00 0.32 71.59 2.22 7.03 1.74 12.31 275.85
6 Other CIS 1.14 0.00 1.77 0.14 63.25 0.50 0.00 6.59 0.35 0.08 2.83 1.59 1.51 0.36 5.78 85.89
7 Iraq 0.00 0.00 25.83 0.77 48.68 0.00 0.00 3.18 2.30 0.00 45.04 47.71 2.72 1.31 23.37 200.91
8 Kuwait 0.00 0.00 3.88 0.00 5.84 0.00 0.00 0.00 4.00 0.00 23.21 11.38 11.68 6.96 36.05 103.00
9 Saudi Arabia 5.57 0.00 43.33 3.35 41.27 0.00 0.00 13.73 9.63 0.50 56.73 39.27 57.41 10.68 85.95 367.42
10 UAE 0.00 0.00 0.27 0.00 0.74 0.00 0.00 0.02 0.85 5.99 12.20 16.05 37.27 10.65 41.86 125.90
11 Other Middle East 0.00 0.00 0.00 0.14 27.62 0.00 0.00 5.68 0.21 0.09 66.03 32.37 21.94 10.54 27.47 192.10
12 North Africa 0.47 0.00 7.85 2.08 58.30 0.00 0.09 1.42 0.04 1.97 11.32 3.96 0.16 1.17 6.77 95.60
13 West Africa 1.08 0.00 16.77 9.48 63.08 0.01 0.00 0.45 10.89 2.45 71.87 27.63 0.52 1.30 14.32 219.85
14 East & S. Africa 0.00 0.00 0.03 0.00 1.16 0.00 0.00 0.04 0.00 0.00 4.36 1.21 0.07 0.00 0.80 7.66
15 Australasia 0.00 0.00 0.07 0.04 0.00 0.00 0.00 0.18 0.00 0.00 1.32 0.28 0.47 1.33 7.23 10.91
16 China 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.52 0.00 1.19 2.71
17 India 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.05 0.00 0.00 0.00 0.00 0.00 0.00 0.05
18 Japan 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
19 Singapore 0.00 0.00 0.00 0.00 0.08 0.00 0.00 0.00 0.00 0.08 0.09 0.00 0.00 0.00 0.39 0.64
20 Other Asia Pacific 0.00 0.00 2.95 0.00 0.00 0.00 0.00 0.39 0.12 11.91 13.07 5.22 2.34 4.82 0.00 40.82
21 Total imports 29.08 0.14 386.26 26.97 519.15 0.51 18.56 40.80 29.17 23.64 464.49 227.50 150.80 52.18 293.84 2263.10

We can have a better view using a heatmap with blue color from/to area

In [9]:
 
Out[9]:
<matplotlib.axes._subplots.AxesSubplot at 0x1bd2517ca20>

And here we calculate the approximate percentage passing through Hormuz by summing the amount moving from Middle east gulf countries. The amount comes to about 35% of world crude oil is passing through this strait.

In [10]:
PercentHormuz=((Crude1['Total']['Saudi Arabia']+Crude1['Total']['Iraq']+Crude1['Total']['UAE']+Crude1['Total']['Kuwait'])*100)/(Crude1['Total']['Total imports'])

PercentHormuz
Out[10]:
35.226919060941675

But since oil is not the only form of energy that people depend on, what is its percentage from overall forms of energy nowadays? For this i will show a sample data of energy consumption by form of energy in TeraWatt-Hours

In [15]:
csvf['totalconsumption (terawatt-hours)']=csvf['Coal (terawatt-hours)']+csvf['Solar (terawatt-hours)']+csvf['Crude oil (terawatt-hours)']+csvf['Natural gas (terawatt-hours)']+csvf['Traditional biofuels (terawatt-hours)']+csvf['Other renewables (terawatt-hours)']+csvf['Hydropower (terawatt-hours)']+csvf['Nuclear (terawatt-hours)']+csvf['Wind (terawatt-hours)']
In [16]:
csvf.tail()
Out[16]:
Entity Code Year Coal (terawatt-hours) Solar (terawatt-hours) Crude oil (terawatt-hours) Natural gas (terawatt-hours) Traditional biofuels (terawatt-hours) Other renewables (terawatt-hours) Hydropower (terawatt-hours) Nuclear (terawatt-hours) Wind (terawatt-hours) totalconsumption (terawatt-hours)
65 World OWID_WRL 2013 44953.01 139.04 50698.38 33714.95 11330.09 463.98 3797.95 2491.71 645.72 148234.84
66 World OWID_WRL 2014 44916.84 197.67 51109.97 33986.85 11220.06 504.39 3887.93 2541.03 712.41 149077.15
67 World OWID_WRL 2015 43786.85 260.01 52053.27 34741.88 11111.11 538.21 3891.41 2575.66 831.83 149790.22
68 World OWID_WRL 2016 43101.23 328.18 53001.87 35741.83 11003.22 556.99 4036.07 2612.83 959.47 151341.69
69 World OWID_WRL 2017 43397.14 442.62 53752.28 36703.97 10895.32 586.17 4059.87 2635.56 1122.75 153595.66

So in this table, Crude oil consumption comes around 53K TWH out of total 153K TWH consumed in 2017. which is around 35% of total energy. So what passes by Hormuz is 35% of world needed crude oil which inturn forms 35% of total world energy needed. This means that about 12% of total needed energy is in danger.

Now let's see in a matplotlib graph the change of energy consumption by form of energy since the year of 1800 until 2017. The graph shows that previously people depended on traditional biofuels for energy while with years, another forms were introduced while the main are coal, crude oil, natural gas and few traditional biofuels. While other forms of energy like solar, nuclear, hydro, wind are still forming low percenatge of total world percentage. The graph also shows how much the amount consumed had changed over the last 70 years, let's say from 1950 until now. World used to consume 25K twh in 1950 while they consume 150K in 2017 which is 6 times higher. The increase could be little justified when we know the increase in world population from 1950 until 2017 from around 2.5 billion up to 7.5 billion which is 3 times higher.

In [17]:
 

Let's plot the same graph using Bokeh. We can see that Bokeh has more interactive graphs where user can zoom in or out or move to a specific location, and also can add more functionalities.

In [22]:
            
from bokeh.core.properties import value
from bokeh.plotting import figure, show, output_notebook
from bokeh.palettes import brewer
from bokeh.models import HoverTool
from bokeh.models import NumeralTickFormatter

output_notebook()

show(p)
Loading BokehJS ...

We can draw it also as a bokeh line graph with tooltips on mouse hovering over the lines

In [24]:
p = figure(x_axis_type="linear")

p.add_tools(hover)

p.title.text = 'Energy Consumption by type'

p.xaxis.axis_label = 'Year'

p.yaxis.axis_label = 'Energy Consumption'

p.legend.location = "top_left"

show(p)

Now let's see the energy consumption by country and some group of countries split by form of energy

Here is a data sample

In [30]:
df_esr['Total (TWH)']=df_esr['Oil (TWH)']+df_esr['Gas (TWH)']+df_esr['Coal (TWH)']+df_esr['Solar PV (TWH)']+df_esr['Other renewables (TWH)']+df_esr['Wind (TWH)']+df_esr['Nuclear (TWH)']+df_esr['Hydropower (TWH)']
df_esr_ds=ColumnDataSource(df_esr)
df_esr.head()
Out[30]:
Entity Code Year Oil (TWH) Gas (TWH) Coal (TWH) Solar PV (TWH) Other renewables (TWH) Wind (TWH) Nuclear (TWH) Hydropower (TWH) Total (TWH)
0 Africa NaN 1965 316.78 10.55 335.59 0.00 0.00 0.00 0.00 14.28 677.20
1 Africa NaN 1966 347.37 11.79 331.37 0.00 0.00 0.00 0.00 15.65 706.18
2 Africa NaN 1967 344.13 11.66 341.01 0.00 0.00 0.00 0.00 16.16 712.96
3 Africa NaN 1968 363.14 11.90 355.41 0.00 0.00 0.00 0.00 18.62 749.07
4 Africa NaN 1969 368.63 14.18 357.51 0.00 0.00 0.00 0.00 21.58 761.90
In [31]:
df_esr1=df_esr[df_esr['Year']==2016].groupby(['Entity']).agg({'Oil (TWH)':'sum','Gas (TWH)':'sum','Coal (TWH)':'sum','Solar PV (TWH)':'sum','Other renewables (TWH)':'sum','Wind (TWH)':'sum',
                                                                 'Nuclear (TWH)':'sum','Hydropower (TWH)':'sum','Total (TWH)':'sum'})

See only year =2016

In [32]:
 
Out[32]:
<matplotlib.axes._subplots.AxesSubplot at 0x1bd268d6a90>

We see that China and US are the highest countries in energy consumption and are much higher than any other country. Remember that even the energy consumption should be relative because a country could be higher in area than other, higher population than other..and other factors. So in the next paragraphs, I will calculate the energy consumption relative to the population to see what countries people are consuming more than other countries people.

So here is a sample of the data after transformation to show the consumption of each year by countries and sorted by the top down in the year of 2016

In [40]:
 
Out[40]:
Year 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 ... 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
Entity
Qatar 180267.50 198989.99 302604.33 317875.75 316817.99 314728.36 315764.44 326531.40 323547.39 296097.34 ... 258220.08 197664.44 181122.49 217830.12 152886.32 161307.05 224496.45 208268.63 235399.98 222633.84
Singapore 89124.45 88203.73 92304.38 98376.08 108993.23 110076.19 106589.74 108263.51 105835.75 103899.29 ... 142073.81 143443.22 149731.01 157850.29 160652.50 157420.81 159329.94 161771.55 169905.09 174083.17
Trinidad and Tobago 56777.72 59626.39 62606.49 65833.56 69612.38 75218.53 85097.51 85052.86 86143.22 95278.41 ... 194059.09 189445.72 194408.64 202172.47 200884.68 190800.41 193506.73 187636.83 184821.80 164894.63
United Arab Emirates 191383.13 220666.01 201032.60 197768.56 206241.84 204962.35 201747.94 200784.75 195700.20 187506.07 ... 140655.72 141735.47 125369.75 121174.71 122665.89 125119.63 125563.14 127543.91 137934.90 142723.65
Kuwait 38989.80 22486.89 inf inf inf 111444.02 108891.82 107460.74 120664.62 116002.71 ... 133571.66 133697.09 130280.91 131930.63 129024.09 140598.75 127731.89 115628.03 122559.24 119754.49
Saudi Arabia nan nan nan nan nan nan nan nan nan nan ... 78951.30 83771.32 85732.87 91621.10 91523.02 94233.49 92218.91 95255.49 96099.20 96024.65
Canada 83361.19 81012.80 82467.82 82792.41 84765.41 86912.69 89095.59 89578.44 88048.47 89335.83 ... 91735.98 90391.68 84606.22 86072.99 88003.75 86249.66 87436.39 86167.24 83640.31 82665.91
North America 89379.04 87935.39 88461.64 89046.98 90040.84 90380.17 92357.25 92470.03 92088.74 92395.08 ... 91476.85 88787.30 83588.41 85874.55 84851.19 82608.01 84115.02 84218.02 82704.47 81685.00
United States 85323.81 83839.38 84273.21 84915.56 85475.71 85903.98 87714.22 87630.71 87124.58 87369.99 ... 85121.47 82269.22 77132.79 79438.15 77846.90 75492.35 77058.61 77366.95 76047.85 75146.04
Turkmenistan 42917.96 42743.78 39637.85 31889.77 33187.97 26648.65 32058.36 31467.35 33704.97 36568.69 ... 57865.45 57706.51 52739.34 59228.78 60593.21 65557.86 57997.49 62715.39 69155.30 68277.57
Australia 59377.90 58376.32 58374.22 59386.40 61098.88 61886.98 62718.51 63628.35 64486.69 64937.72 ... 68391.31 68455.92 67028.27 65191.47 66713.57 64900.76 63958.98 63978.48 65869.64 64353.81
Norway 61754.08 57247.82 59786.19 61714.40 61239.32 62852.94 60970.88 63670.90 64916.90 64945.11 ... 66351.89 66148.02 62525.86 60511.85 61067.08 64350.22 61546.72 61687.19 62167.12 62938.96
South Korea nan nan nan nan nan 35405.99 38633.32 42087.62 37822.93 40743.73 ... 50456.51 50897.96 50964.72 54724.78 57196.92 57709.69 57861.24 57480.19 58087.85 59243.96
Netherlands 59877.02 61332.59 61399.89 61595.93 60858.74 62567.66 64667.07 63693.44 63384.88 62294.02 ... 66451.27 64630.73 63376.55 66018.16 62454.52 59832.01 58340.50 54640.25 55160.62 56536.44
Belgium 54071.78 56060.71 55949.19 54677.08 57697.10 58027.32 61867.26 62076.05 63673.09 62313.13 ... 63921.91 64821.14 58623.47 62231.59 56210.49 54336.76 54995.99 51926.41 53615.56 55783.45
Russia 64733.63 63661.92 61121.30 56889.04 51872.94 48880.09 47180.38 44437.30 44523.32 44975.09 ... 51540.77 51913.25 48892.44 50942.27 52669.84 52557.39 51647.82 51689.64 50874.74 49962.55
Hong Kong 24006.18 24659.16 28765.73 30869.46 27224.15 28714.34 27805.12 28100.81 28394.21 28516.71 ... 44278.06 41050.75 44713.20 45506.07 46271.73 43975.75 44983.91 43583.20 44486.44 45332.15
Finland 50646.43 50938.55 49725.10 50288.48 54071.88 50584.42 53701.86 52842.92 52966.53 52548.38 ... 55999.82 52508.48 49192.60 54142.89 48462.95 44869.97 44637.98 42122.38 41030.30 41914.05
Germany 48077.46 46568.82 44874.98 44439.59 43850.50 nan 45210.12 44277.68 44031.02 43080.62 ... 42235.50 42582.50 40023.86 41739.42 41372.95 41804.03 42942.88 40764.52 41115.62 41536.02
New Zealand 42097.04 40412.36 41087.44 40351.38 41429.80 42085.69 42301.97 43250.18 41864.70 43277.27 ... 41434.02 41757.85 40235.00 40767.91 39769.87 40658.52 40722.69 41815.28 41062.48 40816.91
Kazakhstan 51110.51 50685.76 50120.81 44384.00 40410.85 36372.44 32192.18 28779.67 27793.80 26144.57 ... 38734.91 40005.09 34891.23 37008.73 40405.62 40424.11 40331.03 43895.02 40687.35 40330.65
Czech Republic 52145.32 47579.38 44605.05 43495.37 41591.78 43325.37 44836.43 45205.51 43472.42 40350.20 ... 46022.26 44104.46 40975.92 42814.70 41691.40 40664.36 40220.60 38558.58 38985.53 38988.74
Japan 37006.38 37575.78 38054.34 37949.55 39717.22 40625.95 41264.69 41502.60 40294.92 41162.67 ... 42067.48 41799.40 37609.36 39895.10 39367.96 41077.65 40771.74 39859.38 39133.29 38898.96
Iran 15494.62 16701.18 18027.17 15830.36 17774.51 18443.00 19485.54 20029.26 20595.81 21771.85 ... 33207.33 34292.65 35129.40 34827.18 35909.21 35496.32 36537.25 38432.50 38066.09 38821.36
Austria 35657.44 37386.47 35398.67 35442.14 35252.99 36938.21 37749.05 38188.10 38608.42 38817.33 ... 40851.75 41361.58 39305.27 41424.90 39183.26 39241.26 38935.45 37066.56 37366.24 38043.71
Sweden 45139.33 43123.55 43854.84 43127.52 44007.76 43232.06 43863.59 43019.23 44105.99 43438.71 ... 41922.79 41073.14 37404.79 40165.50 38664.05 39513.37 37773.22 37521.90 38062.99 37714.88
Malaysia 13604.87 16103.58 16935.48 17281.87 17865.78 18523.13 20137.77 23020.10 20831.63 22735.92 ... 31496.66 32266.50 30500.28 29519.53 31863.51 32555.08 34219.48 34441.93 34630.73 36053.12
Ireland 32460.35 33426.79 33370.01 33957.36 35091.52 35697.81 37439.08 38835.38 41170.98 43109.66 ... 43511.07 42249.27 38154.74 37980.79 34918.51 34358.91 33475.40 32995.81 34631.02 35895.05
Israel 28146.73 27498.56 28977.19 29934.17 31908.78 34639.67 35565.71 34156.31 35594.43 36036.55 ... 36989.97 37086.91 34662.46 36265.06 36366.34 36938.46 36315.84 34597.80 35936.50 35822.82
European Union 36910.04 36676.32 35758.31 35265.10 34969.87 35694.73 36811.50 36463.07 36731.49 36432.49 ... 37438.91 37007.65 34539.20 35629.06 34449.83 33926.33 33379.30 31726.10 32179.57 32457.34
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
Portugal 17903.67 18772.57 20038.99 19787.26 20344.09 22238.57 21651.64 22280.18 24506.30 25975.72 ... 25655.74 24922.15 24743.04 24703.27 24108.04 22737.70 23800.64 23819.44 24941.78 25466.78
Switzerland 33262.70 33670.94 33738.24 32557.08 33582.37 31663.20 31484.29 33093.87 33318.97 33435.99 ... 29864.02 30918.01 30621.68 29367.38 27609.48 28611.86 29390.07 27032.91 26710.44 25309.06
South Africa 26318.03 25440.06 25178.50 24880.19 25243.40 25799.58 25821.54 25911.00 25038.75 25560.17 ... 26495.46 28233.43 27891.85 27781.89 27003.48 26335.57 26257.24 26228.07 24804.46 24799.18
Bulgaria 29809.36 24215.88 22747.92 24453.03 23755.44 25901.87 25700.64 24563.87 23603.72 21096.00 ... 26409.49 26179.24 22544.67 23498.32 25873.81 24317.83 22352.74 23881.31 25753.69 24714.93
Venezuela 25790.32 24606.43 26263.49 25219.15 26939.49 27148.14 25446.24 26355.75 27745.65 26002.69 ... 29215.72 29858.24 28827.87 28005.99 27105.55 28275.30 27450.21 25644.10 25411.97 24333.98
China 6817.23 7079.71 7359.72 7807.91 8168.34 8299.34 8658.69 8610.47 8534.30 8765.64 ... 18261.64 18676.32 19459.53 20647.89 22270.00 22843.50 23550.60 23771.28 23790.61 23898.05
Hungary 28717.66 27015.90 25021.37 24831.57 25325.84 25525.32 26270.07 25582.18 25715.05 25486.40 ... 26596.79 26173.91 23642.60 24308.46 23441.48 21774.06 20687.59 20596.89 21922.37 22746.21
Argentina 14807.81 15094.84 15545.57 15310.57 15380.72 15864.99 16660.38 16819.47 17046.38 17000.56 ... 20069.71 20235.23 19276.32 20495.83 20811.21 21268.13 21737.73 21562.11 21816.70 21730.70
Lithuania 45568.86 48627.18 27699.64 21301.95 19901.99 20816.06 22335.80 21167.56 22512.70 19527.30 ... 24599.05 24661.38 22007.61 20621.53 21900.54 22272.02 20566.43 19978.23 21076.94 21497.42
Chile 10162.52 10561.01 11137.04 11665.83 12236.42 13005.40 13975.09 15819.49 16047.98 16740.29 ... 19736.49 19152.40 18561.13 18502.26 20390.72 20499.95 20495.01 20613.60 20748.93 21449.35
Thailand 6082.57 6676.71 7323.96 8293.37 9206.97 9933.52 11099.67 11576.59 10636.79 11287.60 ... 15921.34 16081.07 16450.30 17507.10 18029.04 19177.66 19463.88 19925.19 20334.53 20568.59
Ukraine 57820.69 52365.82 45637.98 37893.56 32376.28 30465.59 29012.77 28653.06 27669.26 28719.32 ... 29983.76 29842.88 25159.62 27031.33 28388.59 27666.13 25828.52 22492.92 18213.08 19260.74
World 16587.41 16402.00 16270.07 16059.96 16029.39 16069.44 16308.90 16256.72 16138.72 16203.36 ... 18720.09 18708.99 18169.06 18831.71 19080.27 19128.83 19224.14 19142.53 19066.23 19053.58
Uzbekistan 26142.56 25937.50 23759.32 24776.25 23917.35 22984.92 22908.52 23583.49 23821.99 24596.09 ... 20552.60 21451.92 17583.91 17203.33 19129.69 18602.58 18121.03 18460.71 18604.64 18625.30
Turkey 9490.04 9577.59 9816.00 10318.83 9911.05 10881.29 11647.56 12100.68 12186.28 11910.69 ... 16324.91 16265.67 16148.14 16623.80 16981.03 17387.21 16795.20 17491.91 17996.84 18535.86
Azerbaijan 36521.74 34633.62 29076.07 24492.90 22218.44 20765.64 16783.06 15850.80 15690.79 15651.90 ... 16173.00 15968.62 13717.85 13107.21 14641.01 15032.27 15319.41 15906.46 17196.91 16926.78
Romania 30680.03 25700.45 23277.32 22340.79 21152.96 23049.18 22941.46 21288.32 19165.35 16606.47 ... 19634.57 19831.54 16916.88 16842.23 17813.33 17670.32 15987.97 16276.42 16464.91 16792.97
Mexico 13880.65 14200.08 14077.89 13900.83 14728.04 13813.47 14141.22 14512.28 15150.59 14966.69 ... 17095.09 17020.36 16896.70 16961.20 17466.26 17488.24 17302.62 17059.25 16751.82 16343.88
Algeria 12598.29 12172.10 12211.91 11075.90 11030.17 11257.58 10987.18 10369.84 10561.49 10544.28 ... 12050.23 12551.06 13081.82 12507.91 13013.16 13958.24 14490.76 15347.05 16069.70 15775.95
Brazil 7485.09 7617.50 7886.93 8094.41 8419.37 8677.61 9036.00 9379.81 9536.59 9565.52 ... 10655.25 11286.61 10922.40 12079.74 12453.61 12703.84 13432.56 13849.47 13664.00 13035.28
Egypt 6608.88 6567.80 6439.27 6388.44 6376.93 6626.37 6853.53 7009.60 7186.44 7555.91 ... 9845.53 10274.17 10520.56 10888.08 10855.13 11188.42 10848.07 10560.12 10491.63 10801.64
Ecuador 5501.70 6061.76 5731.15 5956.22 6312.83 5870.34 6489.59 7166.07 7146.36 6474.17 ... 7929.61 8115.16 8027.68 8944.74 9130.12 9437.25 9745.84 10101.66 9764.25 9248.45
Colombia 5611.21 5765.21 6252.22 6611.87 6876.22 6892.69 6839.64 7153.58 7123.21 6260.20 ... 6430.73 7106.26 6683.99 7190.96 7201.86 7820.66 7819.43 8225.39 8323.25 8184.31
Peru 3857.57 3655.63 3616.41 3783.40 4054.85 4389.24 4448.71 4272.74 4339.24 4358.17 ... 5042.85 5543.74 5562.45 6180.75 6699.91 6930.00 7011.34 7179.46 7487.29 7946.46
Indonesia 3266.08 3474.88 3740.39 3898.57 4121.13 4318.32 4527.93 4875.20 4679.42 5039.90 ... 6503.74 6328.67 6467.62 6979.02 7561.05 7822.02 7868.19 7263.39 7272.26 7635.90
Vietnam 953.15 927.50 985.51 1111.68 1208.35 1381.72 1563.77 1836.15 2000.91 2003.76 ... 3720.52 4627.42 4657.39 5311.51 5798.53 5802.49 5947.72 6452.20 6914.85 6921.99
India 2469.58 2548.24 2642.24 2657.07 2737.54 2902.97 2978.67 3086.51 3193.90 3214.71 ... 4229.72 4426.13 4727.49 4873.55 5057.43 5404.78 5405.34 5708.19 5832.69 6105.72
Pakistan 2729.89 2816.29 2848.88 3089.65 3128.91 3211.10 3337.44 3237.62 3325.50 3473.82 ... 4638.27 4633.05 4576.54 4501.77 4388.51 4346.10 4264.23 4284.80 4410.33 4665.64
Philippines 2550.19 2428.92 2814.49 2830.41 2917.89 3210.35 3365.95 3573.36 3539.62 3428.18 ... 3140.48 3172.41 3175.57 3270.18 3262.18 3310.10 3506.04 3672.98 3979.70 4390.02
Bangladesh 711.30 672.69 719.34 779.62 806.00 939.59 958.64 982.67 1025.30 1020.75 ... 1480.90 1548.27 1690.44 1742.79 1829.57 1970.21 1983.19 2052.37 2248.87 2303.56

69 rows × 27 columns

Let's draw the top 10 in a matplotlib bar graph.

In [41]:
df_esr_pop_filter_pvt.head(10).plot.bar(stacked=False,  figsize=(15,15))
Out[41]:
<matplotlib.axes._subplots.AxesSubplot at 0x1bd274d8160>

and here is the same graph for top 30 but only for year=2016

In [42]:
df_esr_pop_filter1.sort_values('Energy by citizen (KWH)', ascending=False).head(30).plot.bar(rot=45)
Out[42]:
<matplotlib.axes._subplots.AxesSubplot at 0x1bd26b7b8d0>

So what we see here is that people in Qatar are the top consumers of energy and they are much higher than most of the world countries. It shows that also that almost all Arab gulf countries are high consumers of energy, and that would be probably because of the high temperatures and use of air conditioners almost the whole year because of the weather. Other reason is the cheap price of energy in those countries as they are oil producers. The same theory probably applies to Canada where the weather needs conditioning.

I hope, at the end of this demonstartion, i was able to find the answers for the questions in your mind too. If you are interested in more insights, studies or work, please don't hesitate to contact.

If you like this analysis, please like and follow "Bee Eyes" page.

https://www.linkedin.com/company/bee-eyes

In [ ]: