In [1]:
from __future__ import division
import pandas
import seaborn
In [2]:
from openfisca_france_indirect_taxation.examples.utils_example import graph_builder_bar
from openfisca_france_indirect_taxation.surveys import SurveyScenario
In [3]:
seaborn.set_palette(seaborn.color_palette("Set2", 12))
%matplotlib inline
In [4]:
# Sélection des variables utilisées pour la simulation
simulated_variables = ['depenses_carburants', 'depenses_essence', 'depenses_diesel', 'revtot']
for year in [2000, 2005, 2011]:
survey_scenario = SurveyScenario.create(year = year)
pivot_table = pandas.DataFrame()
for values in simulated_variables:
pivot_table = pandas.concat([
pivot_table,
survey_scenario.compute_pivot_table(values = [values], columns = ['strate'])
])
df = pivot_table.T
# Réalisation de graphiques
for element in simulated_variables:
if element == 'revtot':
continue
df['part_{}_revtot'.format(element)] = \
df['{}'.format(element)] / df['revtot']
graph_builder_bar(df[['part_{}_revtot'.format(element)]])