Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import matplotlib.pyplot as plt
- # Leggi i dati demografici
- demography_data = pd.read_csv(r'Contest StatLearning\population-and-demography.csv',delimiter=',')
- plt.plot(demography_data['Year'], demography_data['Population'], )
- plt.xlabel('Year')
- plt.ylabel('Population')
- plt.title('Italy Population, 1950 to 2021')
- plt.grid(linestyle=':')
- plt.show()
- # Leggi i dati GDP per capita
- gdp_data = pd.read_csv(r'Contest StatLearning\gdp-per-capita-maddison-2020.csv',delimiter=',')
- plt.plot(gdp_data['Year'], gdp_data['GDP per capita'])
- plt.xlabel('Year')
- plt.ylabel('GDP per Capita ($)')
- plt.title('GDP per Capita in Italy, 1900 to 2018')
- plt.grid(linestyle=':')
- plt.show()
- # Leggi i dati GDP vs population density
- density_data = pd.read_csv(r'Contest StatLearning\population-density-vs-prosperity.csv',delimiter=',')
- plt.scatter(density_data['Year'], density_data['GDP per capita'], c=density_data['Population density'])
- plt.colorbar(label='Number of people per km²')
- plt.xlabel('Year')
- plt.ylabel('GDP per Capita ($)')
- plt.title('Population density and GDP per Capita Relationship, 1990 to 2020')
- plt.grid(linestyle=':')
- plt.show()
- # Plotto tutti i grafici insieme
- plt.plot(demography_data['Year'], demography_data['Population'])
- plt.plot(gdp_data['Year'], gdp_data['GDP per capita'])
- plt.scatter(density_data['Year'], density_data['GDP per capita'], c=density_data['Population density'])
- plt.colorbar(label='Number of people per km²')
- plt.xlabel('Year')
- plt.title('All charts')
- plt.grid(linestyle=':')
- plt.yscale('log')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment