HDI人類發展指數
-
上傳csv檔案
from google.colab import files data = files.upload()
import pandas as pd import numpy as np import csv # 讀取HDI資料 data1 = pd.read_csv('HDI_world.csv') country = ['日本', '南韓', '中國'] years = np.linspace(1990, 2017, 28) #日本 HDI_country1 = data1.loc[85] #南韓 HDI_country2 = data1.loc[90] #中國 HDI_country3 = data1.loc[35] # 匯入plotly套件,以便繪製視覺化圖形 from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot import plotly.graph_objs as go # Create traces trace1 = go.Scatter( x = years, y = HDI_country1, mode = 'lines+markers', name = country[0] ) # Create traces trace2 = go.Scatter( x = years, y = HDI_country2, mode = 'lines+markers', name = country[1] ) # Create traces trace3 = go.Scatter( x = years, y = HDI_country3, mode = 'lines+markers', name = country[2] ) data = [trace1, trace2, trace3] iplot(data, filename='scatter-mode')
-