导入包
import numpy as np
import pandas as pd
pd. plotting. register_matplotlib_converters( )
import matplotlib. pyplot as plt
% matplotlib inline
import seaborn as sns
print ( "Setup Complete" )
获取数据
data_original = pd. read_csv( "./gdp_csv.csv" )
data_original
获取部分国家的数据
china_data = data_original. loc[ data_original[ "Country Name" ] . isin( [ 'China' ] ) ]
france_data = data_original. loc[ data_original[ "Country Name" ] . isin( [ 'France' ] ) ]
UnitedKingdom_data = data_original. loc[ data_original[ "Country Name" ] . isin( [ 'United Kingdom' ] ) ]
Italy_data = data_original. loc[ data_original[ "Country Name" ] . isin( [ 'Italy' ] ) ]
Japan_data = data_original. loc[ data_original[ "Country Name" ] . isin( [ 'Japan' ] ) ]
India_data = data_original. loc[ data_original[ "Country Name" ] . isin( [ 'India' ] ) ]
可视化
plt. figure( figsize= ( 16 , 6 ) )
sns. lineplot( y= china_data. Value, x= china_data. Year, label= "China" )
sns. lineplot( y= france_data. Value, x= france_data. Year, label= "France" )
sns. lineplot( y= UnitedKingdom_data. Value, x= UnitedKingdom_data. Year, label= "United Kingdom" )
sns. lineplot( y= Italy_data. Value, x= Italy_data. Year, label= "Italy" )
sns. lineplot( y= Japan_data. Value, x= Japan_data. Year, label= "Japan" )
sns. lineplot( y= India_data. Value, x= India_data. Year, label= "India" )
plt. xlabel( "Year" )
plt. ylabel( "Population" )