In [1]:
import pandas as pd # imports
nations_file = "nations.json" # variables
nations = pd.read_json(nations_file) # read data
In [2]:
# get column variable names
nations.columns.values
Out[2]:
array(['income', 'lifeExpectancy', 'name'], dtype=object)
In [3]:
# get summary statistics per variable
nations.describe()
Out[3]:
income
lifeExpectancy
count
180.000000
180.000000
mean
12433.508667
69.130333
std
13807.488074
10.253264
min
358.800000
44.300000
25%
2279.067500
62.077500
50%
7158.380000
72.105000
75%
18112.165000
76.525000
max
74138.280000
82.980000
In [5]:
# get head data of first 100 rows
nations.head(100)
Out[5]:
income
lifeExpectancy
name
0
5055.59
47.58
Angola
1
1457.57
61.89
Benin
2
12282.28
55.12
Botswana
3
1234.42
53.38
Burkina Faso
4
457.07
50.95
Burundi
5
1997.18
51.39
Cameroon
6
3456.14
71.68
Cape Verde
7
1557.83
48.97
Chad
8
1016.42
65.77
Comoros
9
358.80
47.81
Congo, Dem. Rep.
10
3834.67
53.75
Congo, Rep.
11
1520.23
57.86
Cote d'Ivoire
12
15342.20
50.64
Equatorial Guinea
13
548.37
60.03
Eritrea
14
812.16
55.69
Ethiopia
15
12704.99
60.89
Gabon
16
1382.95
56.83
Ghana
17
908.86
58.35
Guinea
18
568.94
48.20
Guinea-Bissau
19
1493.53
54.95
Kenya
20
1521.40
45.56
Lesotho
21
474.90
58.71
Liberia
22
1006.90
60.81
Madagascar
23
866.35
53.88
Malawi
24
1136.17
48.84
Mali
25
1775.87
56.99
Mauritania
26
11411.53
72.10
Mauritius
27
9617.82
75.99
Mayotte
28
888.65
48.13
Mozambique
29
4952.26
61.72
Namibia
...
...
...
...
70
2313.16
63.39
Yemen, Rep.
71
13498.04
75.52
Argentina
72
25351.09
74.92
Aruba
73
15846.77
77.51
Barbados
74
6998.08
76.60
Belize
75
4007.16
66.01
Bolivia
76
9569.78
72.68
Brazil
77
34569.63
80.89
Canada
78
13087.38
78.67
Chile
79
7090.69
73.19
Colombia
80
9551.56
78.98
Costa Rica
81
9277.96
78.84
Cuba
82
7035.45
75.26
Ecuador
83
5646.85
71.74
El Salvador
84
8202.74
76.16
French Guiana
85
8826.90
75.62
Grenada
86
7788.25
79.28
Guadeloupe
87
5163.22
70.55
Guatemala
88
3776.95
67.43
Guyana
89
1198.05
61.48
Haiti
90
3473.46
72.41
Honduras
91
7023.74
72.11
Jamaica
92
14627.13
79.77
Martinique
93
11250.37
76.47
Mexico
94
23178.37
76.38
Netherlands Antilles
95
2591.39
73.44
Nicaragua
96
10796.68
75.81
Panama
97
4054.30
72.07
Paraguay
98
7858.97
73.47
Peru
99
18970.51
78.95
Puerto Rico
100 rows × 3 columns
In [ ]:
Content source: danaoira/metisD3
Similar notebooks: