|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import pandas as pd
|
|
|
|
|
import psycopg2 as psy
|
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data = pd.read_csv(r'co2_emission.csv')
|
|
|
|
@ -19,17 +20,19 @@ try :
|
|
|
|
|
curs.execute('''DELETE FROM CO_DEUX WHERE emission = 0''')
|
|
|
|
|
curs.execute('''DELETE FROM CO_DEUX WHERE code LIKE 'NaN' ''')
|
|
|
|
|
|
|
|
|
|
#Chart that picture the evolution of the emission in France
|
|
|
|
|
df3 =
|
|
|
|
|
|
|
|
|
|
df3 = pd.read_sql('''SELECT * FROM CO_DEUX WHERE code LIKE 'FRA' AND year BETWEEN 2000 AND 2017;''',con=co)
|
|
|
|
|
|
|
|
|
|
fig = df3.plot(x="annee", y="emissions", legend=False, style='-', kind='bar')
|
|
|
|
|
#Chart that picture the evolution of the emission in France
|
|
|
|
|
print("test")
|
|
|
|
|
print(df3)
|
|
|
|
|
fig = df3.plot(x='year', y='emission', legend=False, style='-', kind='bar')
|
|
|
|
|
print("test")
|
|
|
|
|
fig.set_title("Quantité d'émission (tonnes) en fonction des années")
|
|
|
|
|
fig.set_xlabel("Year")
|
|
|
|
|
print("test")
|
|
|
|
|
fig.set_xlabel("annee")
|
|
|
|
|
fig.set_ylabel("emissions")
|
|
|
|
|
fig.set_xticks(df3.index)
|
|
|
|
|
fig.set_xticklabels(df3['year'], rotation='45')
|
|
|
|
|
fig.set_ylim(0,350)
|
|
|
|
|
|
|
|
|
|
plt.show()
|
|
|
|
|
|
|
|
|
|