Thursday, 22 February 2018
Wednesday, 21 February 2018
Monday, 19 February 2018
Sunday, 18 February 2018
100 Real Data international Map Choropleth
In [1]:
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
In [2]:
init_notebook_mode(connected=True)
In [3]:
import pandas as pd
In [5]:
df = pd.read_csv('2014_World_GDP')
df.head()
Out[5]:
COUNTRY | GDP (BILLIONS) | CODE | |
---|---|---|---|
0 | Afghanistan | 21.71 | AFG |
1 | Albania | 13.40 | ALB |
2 | Algeria | 227.80 | DZA |
3 | American Samoa | 0.75 | ASM |
4 | Andorra | 4.80 | AND |
In [6]:
data = dict(
type = 'choropleth',
locations = df['CODE'],
z = df['GDP (BILLIONS)'],
text = df['COUNTRY'],
colorbar = {'title' : 'GDP Billions US'},
)
In [11]:
layout = dict(
title = '2014 Global GDP',
geo = dict(
showframe = False,
projection = {'type':'Mercator'}
)
)
In [13]:
choromap = go.Figure(data = [data],layout = layout)
iplot(choromap)
Subscribe to:
Posts (Atom)