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:
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
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.
#Import needed libraries
import numpy as np
import pandas as pd
#Import plotting libraries and initialize params
import matplotlib.pyplot as plt
PercentHormuz=((Crude1['Total']['Saudi Arabia']+Crude1['Total']['Iraq']+Crude1['Total']['UAE']+Crude1['Total']['Kuwait'])*100)/(Crude1['Total']['Total imports'])
PercentHormuz
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)']
csvf.tail()
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)
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)
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()
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'})
df_esr_pop_filter_pvt.head(10).plot.bar(stacked=False, figsize=(15,15))
df_esr_pop_filter1.sort_values('Energy by citizen (KWH)', ascending=False).head(30).plot.bar(rot=45)