Dataset is from here.
In [46]:
import pandas as pd
import plotly.express as px
data = (
pd.read_excel('../assets/prorogation.xlsx', skiprows=8, skipfooter=3)
.assign(
ProrogationDays=lambda x: x['Calendar Days Between Date of New Session and Prorogation of Previous Session'],
ProrogationDate=lambda x: x['Prorogation Date'].shift(1),
Election=lambda x: x['General Election Before Session'].fillna('N')
)
# Since...
.loc[lambda x: x.ProrogationDate > pd.datetime(1950, 1, 1)]
)
data.info()
In [3]:
fig = px.bar(data, x='ProrogationDate', y='ProrogationDays', color='Election')
with open('../iframes/prorogation_full.html', 'w') as f:
f.write(fig.to_html())
fig