Population

Dan Qin,U201816119

Briefly introduce my data.

It's on the United Nations Population website https://www.un.org/en/development/desa/population/index.asp

This web site presents the main findings of the 2018 Revision of World Urbanization Prospects, which are consistent with the size of the total population of each country as estimated or projected in the 2017 Revision of World Population Prospects (United Nations, 2017).

Find out about

  • the rural, urban, total population
  • gender distribution,
  • age distribution

in various countries of the world in 1980-2015.

Next, based on this set of data, I will briefly analyze

  • China's urbanization,
  • Aging and
  • Age distribution,
  • Gender and compare them with major countries in the world.

Aiming at illustrate the current situation of China

In [280]:
import pandas as pd
data=pd.read_excel('/Users/liaoying/Desktop/population.xlsx')
In [281]:
data
Out[281]:
RowID LocationName LocationID LocationType IsSmallCountry ParentID Year Sex AreaType SortOrder ... 35-39 40-44 45-49 50-54 55-59 60-64 65-69 70-74 75-79 80+
0 NaN World 900 0 False 0 1980 Female Rural 1 ... 66377.635405 62188.927206 56887.096881 51112.965754 44213.385057 35633.110873 30612.055005 23004.611925 14860.076507 11662.619964
1 NaN World 900 0 False 0 1985 Female Rural 1 ... 74951.288161 62874.433954 59565.085094 53709.506420 47700.370884 39864.776614 30542.893972 24542.247680 16585.120771 13947.127653
2 NaN World 900 0 False 0 1990 Female Rural 1 ... 89283.592335 71504.248648 59762.585369 55860.587503 50130.022679 43536.257464 34926.918619 24880.883230 18102.057136 16440.693725
3 NaN World 900 0 False 0 1995 Female Rural 1 ... 92664.652593 84440.019106 67107.946540 55914.303258 51417.496034 44701.254487 37295.062166 27806.986623 17676.140259 18208.346547
4 NaN World 900 0 False 0 2000 Female Rural 1 ... 103958.095674 88528.173095 81176.263539 64197.670735 52963.480532 47842.199869 40109.574009 31249.043782 21157.141465 19624.278688
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
12667 NaN Wallis and Futuna Islands 876 4 True 957 1995 Male Urban 796 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
12668 NaN Wallis and Futuna Islands 876 4 True 957 2000 Male Urban 796 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
12669 NaN Wallis and Futuna Islands 876 4 True 957 2005 Male Urban 796 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
12670 NaN Wallis and Futuna Islands 876 4 True 957 2010 Male Urban 796 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
12671 NaN Wallis and Futuna Islands 876 4 True 957 2015 Male Urban 796 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000

12672 rows × 28 columns

In [282]:
data.isnull().any(axis=0)
Out[282]:
RowID              True
LocationName      False
LocationID        False
LocationType      False
IsSmallCountry    False
ParentID          False
Year              False
Sex               False
AreaType          False
SortOrder         False
Total             False
00-04             False
05-09             False
10-14             False
15-19             False
20-24             False
25-29             False
30-34             False
35-39             False
40-44             False
45-49             False
50-54             False
55-59             False
60-64             False
65-69             False
70-74             False
75-79             False
80+               False
dtype: bool

The RowID represents the number of columns,however,it is meaningless in the data,so we have to delect it.

In [283]:
datas=data.drop('RowID',axis=1)
datas
Out[283]:
LocationName LocationID LocationType IsSmallCountry ParentID Year Sex AreaType SortOrder Total ... 35-39 40-44 45-49 50-54 55-59 60-64 65-69 70-74 75-79 80+
0 World 900 0 False 0 1980 Female Rural 1 1.331308e+06 ... 66377.635405 62188.927206 56887.096881 51112.965754 44213.385057 35633.110873 30612.055005 23004.611925 14860.076507 11662.619964
1 World 900 0 False 0 1985 Female Rural 1 1.409292e+06 ... 74951.288161 62874.433954 59565.085094 53709.506420 47700.370884 39864.776614 30542.893972 24542.247680 16585.120771 13947.127653
2 World 900 0 False 0 1990 Female Rural 1 1.496395e+06 ... 89283.592335 71504.248648 59762.585369 55860.587503 50130.022679 43536.257464 34926.918619 24880.883230 18102.057136 16440.693725
3 World 900 0 False 0 1995 Female Rural 1 1.560483e+06 ... 92664.652593 84440.019106 67107.946540 55914.303258 51417.496034 44701.254487 37295.062166 27806.986623 17676.140259 18208.346547
4 World 900 0 False 0 2000 Female Rural 1 1.610373e+06 ... 103958.095674 88528.173095 81176.263539 64197.670735 52963.480532 47842.199869 40109.574009 31249.043782 21157.141465 19624.278688
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
12667 Wallis and Futuna Islands 876 4 True 957 1995 Male Urban 796 0.000000e+00 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
12668 Wallis and Futuna Islands 876 4 True 957 2000 Male Urban 796 0.000000e+00 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
12669 Wallis and Futuna Islands 876 4 True 957 2005 Male Urban 796 0.000000e+00 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
12670 Wallis and Futuna Islands 876 4 True 957 2010 Male Urban 796 0.000000e+00 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
12671 Wallis and Futuna Islands 876 4 True 957 2015 Male Urban 796 0.000000e+00 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000

12672 rows × 27 columns

As what I showed above,the data has 28 columns and 12670 rows,it is a large data. We can see the basic structure of the data by getting the first 5 rows, which directly matches the population file.

In [284]:
datas.head()
Out[284]:
LocationName LocationID LocationType IsSmallCountry ParentID Year Sex AreaType SortOrder Total ... 35-39 40-44 45-49 50-54 55-59 60-64 65-69 70-74 75-79 80+
0 World 900 0 False 0 1980 Female Rural 1 1.331308e+06 ... 66377.635405 62188.927206 56887.096881 51112.965754 44213.385057 35633.110873 30612.055005 23004.611925 14860.076507 11662.619964
1 World 900 0 False 0 1985 Female Rural 1 1.409292e+06 ... 74951.288161 62874.433954 59565.085094 53709.506420 47700.370884 39864.776614 30542.893972 24542.247680 16585.120771 13947.127653
2 World 900 0 False 0 1990 Female Rural 1 1.496395e+06 ... 89283.592335 71504.248648 59762.585369 55860.587503 50130.022679 43536.257464 34926.918619 24880.883230 18102.057136 16440.693725
3 World 900 0 False 0 1995 Female Rural 1 1.560483e+06 ... 92664.652593 84440.019106 67107.946540 55914.303258 51417.496034 44701.254487 37295.062166 27806.986623 17676.140259 18208.346547
4 World 900 0 False 0 2000 Female Rural 1 1.610373e+06 ... 103958.095674 88528.173095 81176.263539 64197.670735 52963.480532 47842.199869 40109.574009 31249.043782 21157.141465 19624.278688

5 rows × 27 columns

What is more,we can get the last 5 rows to see the basic structure.

In [285]:
datas.tail()
Out[285]:
LocationName LocationID LocationType IsSmallCountry ParentID Year Sex AreaType SortOrder Total ... 35-39 40-44 45-49 50-54 55-59 60-64 65-69 70-74 75-79 80+
12667 Wallis and Futuna Islands 876 4 True 957 1995 Male Urban 796 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
12668 Wallis and Futuna Islands 876 4 True 957 2000 Male Urban 796 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
12669 Wallis and Futuna Islands 876 4 True 957 2005 Male Urban 796 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
12670 Wallis and Futuna Islands 876 4 True 957 2010 Male Urban 796 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
12671 Wallis and Futuna Islands 876 4 True 957 2015 Male Urban 796 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

5 rows × 27 columns

In [286]:
datas.describe()
Out[286]:
LocationID LocationType ParentID Year SortOrder Total 00-04 05-09 10-14 15-19 ... 35-39 40-44 45-49 50-54 55-59 60-64 65-69 70-74 75-79 80+
count 12672.000000 12672.000000 12672.000000 12672.000000 12672.000000 1.267200e+04 12672.000000 12672.000000 12672.000000 12672.000000 ... 12672.000000 12672.000000 12672.000000 12672.000000 12672.000000 12672.000000 12672.000000 12672.000000 12672.000000 12672.000000
mean 528.143939 3.871212 1155.450758 1997.500000 402.132576 3.771441e+04 3998.032330 3808.557811 3667.989631 3510.189088 ... 2486.047194 2231.443639 1964.117372 1698.487612 1436.568377 1179.011927 929.755681 700.795493 484.033960 467.566883
std 517.050039 0.475243 1031.455841 11.456891 227.580234 1.962581e+05 21035.558177 20087.649114 19348.437950 18460.732249 ... 13214.851397 11939.411099 10514.043165 9018.274865 7560.869892 6186.793153 4794.857220 3602.522567 2516.336316 2561.457717
min 4.000000 0.000000 0.000000 1980.000000 1.000000 0.000000e+00 0.000000 0.000000 0.000000 0.000000 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
25% 245.000000 4.000000 911.000000 1988.750000 204.250000 1.232616e+02 12.892912 12.293409 11.843851 11.380352 ... 7.627487 6.537985 5.484059 4.549367 3.680750 2.878921 2.136500 1.540148 0.973652 0.814832
50% 497.000000 4.000000 920.000000 1997.500000 404.500000 1.544067e+03 153.453843 148.282441 146.002000 143.094060 ... 92.144097 80.414882 69.848554 59.480519 49.716614 39.139143 30.185808 21.679333 13.627476 10.351877
75% 734.000000 4.000000 925.000000 2006.250000 596.500000 7.893457e+03 919.634237 852.179000 788.860760 750.548273 ... 469.323000 407.059547 359.216254 313.611203 271.282473 224.537825 177.078000 129.830960 87.653060 76.001301
max 5501.000000 5.000000 5501.000000 2015.000000 796.000000 3.693185e+06 344424.504000 328108.756000 322750.612000 320351.663000 ... 251774.573000 242941.972000 226662.469000 201050.008000 170963.664000 149031.553000 111840.292000 82009.050000 64028.780000 76951.735000

8 rows × 23 columns

In [287]:
datas.dtypes
Out[287]:
LocationName       object
LocationID          int64
LocationType        int64
IsSmallCountry       bool
ParentID            int64
Year                int64
Sex                object
AreaType           object
SortOrder           int64
Total             float64
00-04             float64
05-09             float64
10-14             float64
15-19             float64
20-24             float64
25-29             float64
30-34             float64
35-39             float64
40-44             float64
45-49             float64
50-54             float64
55-59             float64
60-64             float64
65-69             float64
70-74             float64
75-79             float64
80+               float64
dtype: object

After knowing the structure, type, first five lines of data and last five lines of data,

we can start to analyze!

Urbanization

First,I want to look at the population in rural,urban and total .

In [288]:
num = (
    datas
    .reset_index()
    .pivot_table(index=["AreaType","Year"], columns="LocationName", values="Total")
)
num.head()
Out[288]:
LocationName Afghanistan Africa Albania Algeria American Samoa Andorra Angola Anguilla Antigua and Barbuda Argentina ... Viet Nam Wallis and Futuna Islands Western Africa Western Asia Western Europe Western Sahara World Yemen Zambia Zimbabwe
AreaType Year
Rural 1980 5556.7755 175343.6480 905.7335 5497.6775 4.1655 1.4310 3063.7975 0.0 22.9820 2406.1250 ... 22165.6915 5.6160 52301.1230 27159.7335 23373.5825 17.0115 1.349755e+06 3299.8300 1759.5735 2829.2260
1985 4786.9620 195472.4090 999.0465 5943.9960 4.3640 1.0795 3510.3235 0.0 21.3600 2269.8270 ... 24798.5510 6.7670 57481.0015 27865.5290 23145.7800 14.4270 1.430276e+06 3939.0330 2063.3045 3304.2665
1990 4791.2695 216531.8520 1095.6200 6286.3550 4.4815 1.4415 3845.1440 0.0 19.9875 2123.2625 ... 27476.1015 6.9400 62686.4890 28799.9320 22960.5155 15.0090 1.517893e+06 4661.2015 2376.6215 3714.5410
1995 7055.8300 239800.4315 1025.6345 6449.7785 3.8915 2.0235 4304.5350 0.0 22.5685 2061.4270 ... 29576.8885 7.0715 69487.3530 31202.7035 22983.1190 16.2715 1.586880e+06 5724.9080 2780.4135 3972.9915
2000 8106.1535 264767.2485 962.7170 6356.7990 3.2825 2.4870 4705.3025 0.0 26.3510 2003.4650 ... 30586.2410 7.2485 76299.8000 33197.4490 22752.9970 24.6620 1.635785e+06 6459.9625 3292.7940 4141.3335

5 rows × 264 columns

China has been promoting urbanization. To see the rural and urban population distribution and the proportion of urban population to total population in China.

In [289]:
China=num.loc[:,"China"]
China
Out[289]:
AreaType  Year
Rural     1980    396766.2860
          1985    409655.9600
          1990    428631.0385
          1995    427187.7220
          2000    410522.7375
          2005    378829.5530
          2010    345217.6200
          2015    311053.9925
Total     1980    492007.8385
          1985    531149.6085
          1990    582714.4835
          1995    618765.7145
          2000    640214.2915
          2005    659088.4175
          2010    679910.7325
          2015    700793.3045
Urban     1980     95241.5525
          1985    121493.6485
          1990    154083.4450
          1995    191577.9925
          2000    229691.5540
          2005    280258.8645
          2010    334693.1125
          2015    389739.3120
Name: China, dtype: float64
In [290]:
import matplotlib.pyplot as plt
labels='Urban','Rural'
sizes=China.loc["Urban",1980],China.loc["Rural",1980]
colors='lightgreen','gold'
explode=0,0
plt.pie(sizes,explode=explode,labels=labels,
        colors=colors,autopct='%1.1f%%',shadow=True,startangle=50)
plt.axis('equal')
plt.show()
ax.set_title("Proportion of urban and rural population in China in 1980 ")
Out[290]:
Text(0.5, 1, 'Proportion of urban and rural population in China in 1980 ')
In [291]:
labels='Urban','Rural'
sizes=China.loc["Urban",2015],China.loc["Rural",2015]
colors='lightskyblue','lightcoral'
explode=0,0
plt.pie(sizes,explode=explode,labels=labels,
        colors=colors,autopct='%1.1f%%',shadow=True,startangle=50)
plt.axis('equal')
plt.show()
ax.set_title("Proportion of urban and rural population in China in 2015 ")
Out[291]:
Text(0.5, 1, 'Proportion of urban and rural population in China in 2015 ')
In [341]:
a=China.loc["Urban",2015]/China.loc["Total",2015]
print("The proportion of urban population to total population in 2015 is ",a)
b=China.loc["Urban",1980]/China.loc["Total",1980]
print("The proportion of urban population to total population in 1980 is ",b)
c=a-b
print(f"The difference between 1980 and 2005 is {c*100}%")
The proportion of urban population to total population in 2015 is  0.5561401764220195
The proportion of urban population to total population in 1980 is  0.1935773072038162
The difference between 1980 and 2005 is 36.25628692182033%

Compared to America,which is the richest country all over the world.

In [293]:
America = [
    "Central America","South America","Northern America",
    "United States of America", "Latin America and the Caribbean"
]
Ame = num[America]
Ame
Out[293]:
LocationName Central America South America Northern America United States of America Latin America and the Caribbean
AreaType Year
Rural 1980 18530.9090 39269.4750 33213.3575 30224.4560 64977.5765
1985 19370.9290 39060.8100 33906.8185 30845.1165 65599.5530
1990 20112.7655 38345.1510 34675.4870 31430.9760 65663.3945
1995 20965.0825 37279.4400 33755.6780 30479.9550 65628.0425
2000 21725.9350 35830.1325 32956.3310 29800.9040 65000.9745
2005 22034.4570 35669.6680 33134.0630 29923.2630 64871.1920
2010 22286.3725 35226.7900 33276.1990 30018.8050 64274.9455
2015 22540.0135 34721.0710 33146.8290 29883.3220 63648.0315
Total 1980 46691.8210 120508.8190 127399.8295 115088.1805 182075.2085
1985 51913.4340 134275.0815 133915.2935 120935.0010 202164.5565
1990 57552.9600 147917.5365 141143.0585 127253.3235 222601.3250
1995 63909.0385 161026.0190 148729.0350 134019.8270 243172.6185
2000 69798.0255 174123.2245 157708.5510 142297.1975 263139.1140
2005 74897.6530 186293.8495 165273.0585 149082.8985 281273.1445
2010 80272.9980 197010.3485 173250.4500 156123.5580 298095.7225
2015 85967.1155 207526.6345 180563.9095 162563.8170 315044.4585
Urban 1980 28160.9120 81239.3440 94186.4720 84863.7245 117097.6320
1985 32542.5050 95214.2715 100008.4750 90089.8845 136565.0035
1990 37440.1945 109572.3855 106467.5715 95822.3475 156937.9305
1995 42943.9560 123746.5790 114973.3570 103539.8720 177544.5760
2000 48072.0905 138293.0920 124752.2200 112496.2935 198138.1395
2005 52863.1960 150624.1815 132138.9955 119159.6355 216401.9525
2010 57986.6255 161783.5585 139974.2510 126104.7530 233820.7770
2015 63427.1020 172805.5635 147417.0805 132680.4950 251396.4270
In [294]:
d=Ame.loc["Urban",2015].mean()/Ame.loc["Total",2015].mean()
d
Out[294]:
0.8067186601567283
In [295]:
d-a
Out[295]:
0.2505784837347088
In [296]:
plt.figure(figsize=(8, 6), dpi=80)
plt.subplot(1, 1, 1)
N = 2
values = (a,d)
index = np.arange(N)
width = 0.2
p2 = plt.bar(index, values, width, label="num", color="#87CEFA")
plt.xlabel('Country')
plt.ylabel('Urbanization Rate')
plt.title('Urbanization rate of China and America in 2015 ')
plt.xticks(index, ('China', 'America'))
plt.legend(loc="upper right")
plt.show()

We can see the proportion of urban population to total population of American is about 25.1% higher than the proportion of urban population to total population of China in 2015.

  • Conclusion:

we should work harder to promote urbanization. Aiming at create more beautiful lives to Chinese people.

What is more,many developing countries also vigorously develop urbanization,

take Brazil and Russia for example.

In [302]:
def urbanization(x,y):
    a=num.loc["Urban",x]/num.loc["Total",x]
    b=num.loc["Urban",y]/num.loc["Total",y]
    c=a-b
    return c
In [307]:
x=urbanization("Brazil","China")
print(x)
x.plot(kind='bar')
Year
1980    0.461098
1985    0.469887
1990    0.474796
1995    0.466486
2000    0.453147
2005    0.403121
2010    0.351094
2015    0.300732
dtype: float64
Out[307]:
<matplotlib.axes._subplots.AxesSubplot at 0x12416de50>
In [305]:
y=urbanization("Russian Federation","China")
print(y)
y.plot(kind='bar')
Year
1980    0.503938
1985    0.490495
1990    0.469512
1995    0.424105
2000    0.374726
2005    0.309406
2010    0.244611
2015    0.183937
dtype: float64
Out[305]:
<matplotlib.axes._subplots.AxesSubplot at 0x123bca450>

Even compared with developing countries, China's urbanization is insufficient.

However,the difference is decreasing.

Totally,we can see the difference by the picture.

In [308]:
countries=["China","Russian Federation","Brazil"]
u_c=num.loc["Urban",countries]
t_c=num.loc["Total",countries]
countries_urbanization=u_c/t_c
countries_urbanization.plot(figsize=(8,6))
Out[308]:
<matplotlib.axes._subplots.AxesSubplot at 0x122d1cad0>
  • So, what is the overall situation of urbanization in the world?
In [74]:
worldu=num.loc[("Urban",2015),:]/num.loc[("Total",2015),:]
def urbanization(x):
    if x>0.7:
        out="High"
    elif 0.3<=x<=0.7:
        out="Median"
    else: 
        out="Low"
    return out
worldclass=worldu.agg(urbanization)
def count(lst,x):
    count=0
    for ele in lst:
        if(ele==x):
            count=count+1
    return count

print("The number of countries with low urbanizationt is",count(worldclass,"Low"))
print("The number of countries with median urbanizationt is",count(worldclass,"Median"))
print("The number of countries with high urbanizationt is",count(worldclass,"High"))

    
The number of countries with low urbanizationt is 35
The number of countries with median urbanizationt is 126
The number of countries with high urbanizationt is 103
In [83]:
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
name=["Low","Median","High"]
number=[count(worldclass,"Low"),count(worldclass,"Median"),count(worldclass,"High")]
fig, ax = plt.subplots()
ax.bar(name,number,align="center")
ax.set_title("World urbanization rate")
fig.tight_layout()

Above all,there are more countries with high and medium urbanization rate, and less countries with low urbanization rate

Ageing of population

Another problem of the international community is the aging of the population。

The population aged over 60 in a country or region accounts for 10% of the total population,

which is the standard of population aging

In [309]:
datas["old"]=datas["60-64"]+datas["65-69"]+datas["70-74"]+datas["75-79"]+datas["80+"]
datas["oldtotal"]=datas["old"]/datas["Total"]
aging=datas.pivot_table(
    index=["LocationName","Year"],
    columns=["AreaType"],
    values=['oldtotal']
)
aging
Out[309]:
oldtotal
AreaType Rural Total Urban
LocationName Year
Afghanistan 1980 0.038050 0.037457 0.034267
1985 0.034210 0.033611 0.030675
1990 0.031403 0.030831 0.028276
1995 0.035018 0.034333 0.031549
2000 0.034441 0.033706 0.030985
... ... ... ... ...
Zimbabwe 1995 0.057030 0.047517 0.026753
2000 0.061302 0.050177 0.028015
2005 0.067016 0.054626 0.030316
2010 0.068769 0.056164 0.030402
2015 0.069503 0.057030 0.030490

2112 rows × 3 columns

In [310]:
aging1=aging>0.1
aging1.all(axis=1)
aging2=aging[aging1.all(axis=1)]
aging2
Out[310]:
oldtotal
AreaType Rural Total Urban
LocationName Year
Albania 2005 0.115562 0.123603 0.132790
2010 0.135169 0.141915 0.148121
2015 0.155378 0.162582 0.167947
Andorra 1985 0.137183 0.119252 0.118340
1990 0.196106 0.138612 0.135385
... ... ... ... ...
Western Europe 2005 0.238195 0.226562 0.222911
2010 0.253911 0.242092 0.238644
2015 0.270955 0.259675 0.256604
World 2010 0.101989 0.110673 0.118771
2015 0.111968 0.122325 0.131114

652 rows × 3 columns

From this picture, we know which country has a serious aging population in which year.

What is the current situation of China's aging population

In [311]:
chinaage=aging2.loc["China"]
chinaage
Out[311]:
oldtotal
AreaType Rural Total Urban
Year
2010 0.139195 0.124475 0.109291
2015 0.166820 0.149390 0.135478

Since 2010 , China has entered an aging society, so a series of policies such as the two child policy are meaningful.

In [312]:
chinaage.idxmax()
Out[312]:
          AreaType
oldtotal  Rural       2015
          Total       2015
          Urban       2015
dtype: int64
  • A graphic illustration of China's aging from 2010 to 2015
In [313]:
import pyecharts.options as opts
from pyecharts.charts import Line
In [314]:
def ageing_trend(legion, area, time, data):
    
    time_start = time[0]
    time_end = time[-1]
    
    x = [str(i) for i in list(range(int(time_start), int(time_end)+5, 5))]
    
    y = []
    hash_area = ['Rural', 'Total', 'Urban']
    hash_time = [str(i) for i in list(range(1980, 2015+5, 5))]
    
    for l in legion:
        for a in area:
            y_la = [round(data.loc[l].values.tolist()[i][hash_area.index(a)], 4) 
                    for i in range(hash_time.index(time_start), hash_time.index(time_end)+1)]
            y.append(y_la)
            
    c = (Line()
        .set_global_opts(
            tooltip_opts = opts.TooltipOpts(
                is_show = True, 
                trigger = 'axis',
            ),
            xaxis_opts = opts.AxisOpts(type_ = 'category'),
            yaxis_opts = opts.AxisOpts(type_ = 'value')
        )
        .add_xaxis(xaxis_data = x))
        
    for i, y_i in enumerate(y):
        (c
            .add_yaxis(
                series_name = legion[i // len(area)] + '-' + area[i % len(area)],
                y_axis = y_i,
                label_opts = opts.LabelOpts(is_show = False)
            ))
            
    return c
        
In [315]:
chinad= ageing_trend(['China'], ['Urban', 'Rural','Total'], ['2010','2015'], aging)
chinad.render_notebook()
Out[315]:

The figure shows that the aging in Chinese urban,rural and total in 2015 is more serious than that in 2010.

And rural areas are more serious than urban areas.

As we all know,Japan's aging population is very serious.

In [316]:
janage=aging2.loc["Japan"]
janage
Out[316]:
oldtotal
AreaType Rural Total Urban
Year
1980 0.164674 0.127924 0.116417
1985 0.186134 0.145938 0.133720
1990 0.220314 0.173543 0.159822
1995 0.251016 0.202847 0.189255
2000 0.277478 0.232308 0.220025
2005 0.301641 0.264410 0.258330
2010 0.348104 0.306213 0.301826
2015 0.375979 0.330875 0.327737

As shown in the figure above, Japan has entered an aging society since 1980

In [317]:
c = ageing_trend(['Japan','China'], ['Urban', 'Rural'], ['1985', '2010'], aging)
c.render_notebook()
Out[317]:

Show by picture,China's aging level is significantly lower than Japan's.

In [318]:
country=["More developed regions",
         "Less developed regions",
         "Least developed countries"
        ]
answerone=aging2.loc[country]
answerone
Out[318]:
oldtotal
AreaType Rural Total Urban
LocationName Year
More developed regions 1980 0.172530 0.154211 0.146441
1985 0.183525 0.163804 0.155894
1990 0.199471 0.175749 0.166698
1995 0.208004 0.183172 0.174137
2000 0.219407 0.193883 0.185013
2005 0.222378 0.200694 0.193771
2010 0.234835 0.217469 0.212317
2015 0.252410 0.235876 0.231286
In [319]:
world= ageing_trend(['More developed regions', 'Less developed regions','Least developed countries'], ['Urban', 'Rural'], ['1985', '2010'], aging)
world.render_notebook()
Out[319]:
  • Conclusion:

The more developed regions, the more serious the problem of aging.

Age distribution

In [320]:
aging_dist = datas.pivot_table(
    index = ['LocationName', 'AreaType', 'Year'],
    values = ['Total', '00-04', '05-09', '10-14', '15-19', '20-24', '25-29', '30-34', '40-44', 
              '45-49', '50-54', '55-59', '60-64', '65-69', '70-74', '75-79', '80+'],
    aggfunc = sum
)
aging_dist
Out[320]:
00-04 05-09 10-14 15-19 20-24 25-29 30-34 40-44 45-49 50-54 55-59 60-64 65-69 70-74 75-79 80+ Total
LocationName AreaType Year
Afghanistan Rural 1980 2134.670152 1674.161759 1379.329322 1142.958692 952.153897 788.494444 699.302280 456.024494 370.688023 299.547044 235.868330 174.212760 119.305452 73.490445 37.352873 17.808094 11113.551
1985 1888.780559 1494.126835 1211.516285 992.624719 818.826639 689.027515 581.596084 376.098685 286.279450 218.336788 175.824602 139.589563 93.380761 54.697222 27.355329 11.525314 9573.924
1990 1898.349640 1512.253823 1247.427465 1009.086829 820.870240 668.665143 566.148344 424.401314 292.592115 208.771959 149.153328 117.226940 90.842491 54.063233 25.844764 11.684509 9582.539
1995 2831.482138 2178.244471 1778.224886 1477.282874 1214.872262 991.876815 809.210440 558.830013 486.170485 355.269990 263.592437 191.204216 137.974688 91.013977 47.568130 25.220248 14111.660
2000 3394.743578 2579.193145 2035.260598 1649.032815 1351.763975 1107.274803 911.526849 621.211158 510.714592 435.324771 307.932125 219.608650 149.484543 99.234447 57.144391 31.785319 16212.307
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
Zimbabwe Urban 1995 525.906392 425.870791 396.766722 417.556199 457.046560 397.108653 312.367921 179.320236 109.255051 82.778999 57.161274 42.910222 24.810057 18.027940 7.663734 5.669582 3693.381
2000 558.334132 456.118889 441.337794 513.118486 581.256762 473.902028 337.852853 191.458791 145.422263 85.572126 68.983082 50.585392 28.741296 22.744105 8.642400 7.823765 4220.985
2005 570.734520 455.511208 444.729567 530.767011 651.547967 533.229824 340.827977 162.948544 129.541270 101.241801 64.673103 56.501767 31.517830 24.561939 10.191089 8.893701 4335.602
2010 588.131412 447.702109 424.216728 507.028396 642.936672 588.761577 389.690159 137.203176 102.862617 85.551082 74.734273 51.117511 34.299586 26.080256 10.582869 9.987000 4341.045
2015 609.148657 469.454738 419.403991 501.195050 681.884339 688.309343 547.593104 197.950250 114.208427 79.925844 69.337407 63.423180 32.772526 29.562644 11.623216 11.078155 4871.253

6336 rows × 17 columns

In [321]:
aging_dist.loc['China']
Out[321]:
00-04 05-09 10-14 15-19 20-24 25-29 30-34 40-44 45-49 50-54 55-59 60-64 65-69 70-74 75-79 80+ Total
AreaType Year
Rural 1980 83282.677002 105203.656999 106257.041631 87683.844761 65170.695665 68488.249391 50234.810965 36028.274944 33929.844292 29526.614953 25299.963913 22315.795016 16985.378642 11982.725466 7409.428787 4599.764432 793532.572
1985 86860.461240 78810.041314 99349.591817 98897.072030 79612.373846 63687.146179 65303.895682 36947.933856 34469.428764 32173.465552 27364.523251 22381.801230 18666.853181 13080.045753 8183.783145 6008.900285 819311.920
1990 108383.934101 84066.569787 75930.071609 92266.402672 91198.050259 72899.894087 56934.359128 44561.857987 34257.767682 31234.966200 29149.434439 24437.600047 19341.065038 15069.674021 9307.334880 7210.062984 857262.077
1995 81972.516869 102985.509246 79476.121725 69888.048834 84206.151482 83852.417087 68644.227344 56046.695833 40812.782176 31310.194203 27466.028368 24404.107553 19400.181449 14079.975944 9737.968801 7486.140632 854375.444
2000 57238.010902 77611.097054 97566.278277 64115.721691 55267.087493 71561.515515 76221.781774 49745.412656 53962.235564 39391.017665 29938.973153 26157.829809 22552.447786 16639.508991 10807.425855 9296.357012 821045.475
2005 50497.205255 54431.495784 72609.132870 72971.051319 54044.372308 50044.228225 64699.602675 56067.726085 46501.028892 48029.599792 34553.815807 25842.339743 22583.944834 17934.098200 11772.406237 10112.231432 757659.106
2010 51217.759520 45163.484790 47304.689303 51386.724722 60657.016759 46296.291165 40930.009704 60366.057077 51323.359586 41272.412691 44157.336840 31294.239365 22505.361400 17678.828825 12907.843001 11551.583783 690435.240
2015 47757.145629 43009.110715 38906.343200 33955.739122 42254.228710 50667.389524 39271.863164 50915.430229 52242.944273 44767.641347 37463.749003 37754.250453 25420.247574 16570.250683 12183.215314 11692.576879 622107.985
Total 1980 98790.309000 123126.870000 126427.152000 107938.656000 86492.061000 88737.972000 64293.045000 47247.224000 44487.426000 37856.536000 31387.007000 27303.533000 20614.082000 14578.406000 9044.731000 5709.592000 984015.677
1985 108906.013000 97333.901000 122457.909000 125884.252000 107271.802000 85828.619000 87987.402000 49271.389000 46289.346000 43120.160000 36051.891000 28989.858000 24043.509000 16834.087000 10574.886000 7838.158000 1062299.217
1990 136834.851000 107720.932000 96908.899000 121984.088000 125158.824000 106503.052000 85142.496000 62786.287000 48340.803000 44962.825000 41189.899000 33438.375000 25667.568000 19718.739000 12265.331000 9668.704000 1165428.967
1995 109707.576000 135717.236000 107329.934000 96502.955000 121206.101000 124204.245000 105623.393000 86048.792000 61658.432000 47035.216000 43060.527000 38355.385000 29739.250000 21155.357000 14437.453000 11428.906000 1237531.429
2000 83372.183000 109038.689000 135323.217000 106946.991000 95921.855000 120353.899000 123272.914000 83350.916000 84620.724000 60121.376000 45174.572000 40256.694000 34277.514000 24613.812000 15589.309000 13484.173000 1280428.583
2005 78477.373000 83055.222000 108795.693000 134743.841000 106031.432000 94936.462000 119245.181000 103575.341000 82106.866000 82882.750000 58208.415000 42815.370000 36713.628000 29195.381000 18961.029000 16261.607000 1318176.835
2010 85578.986000 78235.086000 82893.073000 108370.459000 133873.687000 105153.612000 94140.898000 121039.748000 102224.679000 80577.301000 80467.263000 55392.410000 39275.246000 31531.588000 22758.080000 19980.314000 1359821.465
2015 91238.085000 85290.706000 78080.777000 82604.506000 107827.031000 133206.619000 104616.291000 117516.305000 119760.437000 100504.348000 78300.252000 76554.742000 50808.615000 33870.273000 24610.100000 23168.305000 1401586.609
Urban 1980 15507.631998 17923.213001 20170.110369 20254.811239 21321.365335 20249.722609 14058.234035 11218.949056 10557.581708 8329.921047 6087.043087 4987.737984 3628.703358 2595.680534 1635.302213 1109.827568 190483.105
1985 22045.551760 18523.859686 23108.317183 26987.179970 27659.428154 22141.472821 22683.506318 12323.455144 11819.917236 10946.694448 8687.367749 6608.056770 5376.655819 3754.041247 2391.102855 1829.257715 242987.297
1990 28450.916899 23654.362213 20978.827391 29717.685328 33960.773741 33603.157913 28208.136872 18224.429013 14083.035318 13727.858800 12040.464561 9000.774953 6326.502962 4649.064979 2957.996120 2458.641016 308166.890
1995 27735.059131 32731.726754 27853.812275 26614.906166 36999.949518 40351.827913 36979.165656 30002.096167 20845.649824 15725.021797 15594.498632 13951.277447 10339.068551 7075.381056 4699.484199 3942.765368 383155.985
2000 26134.172098 31427.591946 37756.938723 42831.269309 40654.767507 48792.383485 47051.132226 33605.503344 30658.488436 20730.358335 15235.598847 14098.864191 11725.066214 7974.303009 4781.883145 4187.815988 459383.108
2005 27980.167745 28623.726216 36186.560130 61772.789681 51987.059692 44892.233775 54545.578325 47507.614915 35605.837108 34853.150208 23654.599193 16973.030257 14129.683166 11261.282800 7188.622763 6149.375568 560517.729
2010 34361.226480 33071.601210 35588.383697 56983.734278 73216.670241 58857.320835 53210.888296 60673.690923 50901.319414 39304.888309 36309.926160 24098.170635 16769.884600 13852.759175 9850.236999 8428.730217 669386.225
2015 43480.939371 42281.595285 39174.433800 48648.766878 65572.802290 82539.229476 65344.427836 66600.874771 67517.492727 55736.706653 40836.502997 38800.491547 25388.367426 17300.022317 12426.884686 11475.728121 779478.624
In [322]:
aging_dist.loc['Japan']
Out[322]:
00-04 05-09 10-14 15-19 20-24 25-29 30-34 40-44 45-49 50-54 55-59 60-64 65-69 70-74 75-79 80+ Total
AreaType Year
Rural 1980 1952.958589 2276.075590 2070.270454 1830.290978 1542.196029 1964.175241 2212.944790 1834.816488 1972.136535 1948.898640 1587.262372 1286.859733 1166.213795 922.062771 647.998392 539.698365 27615.502
1985 1734.519675 2036.536650 2299.269110 1825.024132 1430.929050 1625.940946 2017.081354 1856.454968 1807.286850 1932.186822 1895.690919 1529.033396 1205.713098 1043.778020 752.071819 690.309561 27942.380
1990 1451.400695 1801.767456 2047.699370 2029.306183 1397.172798 1451.212305 1637.076343 2252.250449 1821.655674 1766.836239 1876.403444 1825.220981 1441.381111 1092.967997 877.602475 889.078931 27703.483
1995 1275.195408 1535.666151 1816.662494 1816.237788 1621.793437 1439.094869 1492.867718 2053.505603 2224.399059 1784.784075 1723.526057 1805.757171 1719.251381 1318.365207 933.137693 1117.489893 27366.317
2000 1177.502371 1329.648334 1544.326479 1609.616389 1428.364410 1640.619355 1460.323271 1688.907556 2024.474558 2185.017839 1753.690409 1683.994558 1712.681918 1576.532453 1152.931677 1348.360931 26841.781
2005 749.945776 830.076198 905.159268 939.077427 890.185385 1002.421027 1122.429812 1031.379176 1133.317086 1354.603324 1445.862102 1171.197621 1090.390481 1059.628239 919.372153 1148.660464 17804.779
2010 480.741079 532.526621 581.469323 564.202652 536.815435 592.266658 675.487073 699.581763 706.259420 778.529426 932.915440 985.760823 802.224943 724.301016 672.709744 1028.218327 12070.342
2015 324.124948 349.612652 374.188109 378.095424 328.696312 371.623018 411.255378 532.289403 521.996785 543.995470 546.201594 581.462210 625.987438 550.020097 485.567042 866.280275 8245.551
Total 1980 8425.462000 10023.593000 8861.847000 8199.056000 7778.115000 9054.658000 10669.960000 8273.704000 8007.568000 7113.685000 5523.713000 4375.630000 3912.158000 2978.445000 2003.147000 1591.386000 115912.104
1985 7406.792000 8504.840000 10033.840000 8884.920000 8132.473000 7766.015000 9070.608000 9053.998000 8173.900000 7851.159000 6915.436000 5319.246000 4108.403000 3514.634000 2453.968000 2160.195000 119988.663
1990 6430.434000 7460.626000 8498.302000 9995.297000 8702.295000 7997.355000 7726.074000 10554.906000 8934.009000 8023.815000 7641.491000 6662.651000 5021.324000 3738.316000 2975.016000 2871.904000 122249.285
1995 5970.705000 6528.210000 7471.766000 8530.933000 9884.930000 8694.585000 8056.326000 9019.486000 10519.841000 8841.513000 7891.922000 7392.964000 6317.749000 4619.441000 3216.916000 3762.988000 124483.305
2000 5858.083000 5992.304000 6534.552000 7481.678000 8394.685000 9782.756000 8684.281000 7741.920000 8928.982000 10342.985000 8654.066000 7673.926000 7024.429000 5825.320000 4082.687000 4665.812000 125714.674
2005 5639.483000 5877.963000 6010.086000 6582.365000 7549.657000 8470.903000 9789.363000 8012.676000 7724.264000 8860.128000 10101.564000 8453.822000 7351.925000 6540.869000 5171.887000 6136.503000 126978.754
2010 5393.342000 5598.901000 5928.424000 6055.616000 6795.206000 7425.856000 8338.003000 8668.379000 7940.356000 7657.775000 8754.496000 9842.212000 8260.959000 6969.029000 5927.028000 8085.933000 127352.833
2015 5341.202000 5399.185000 5603.801000 5960.789000 6111.554000 6843.872000 7455.781000 9688.001000 8620.321000 7859.541000 7528.520000 8527.540000 9467.962000 7773.420000 6284.234000 10007.646000 126818.019
Urban 1980 6472.503411 7747.517410 6791.576546 6368.765022 6235.918971 7090.482759 8457.015210 6438.887512 6035.431465 5164.786360 3936.450628 3088.770267 2745.944205 2056.382229 1355.148608 1051.687635 88296.602
1985 5672.272325 6468.303350 7734.570890 7059.895868 6701.543950 6140.074054 7053.526646 7197.543032 6366.613150 5918.972178 5019.745081 3790.212604 2902.689902 2470.855980 1701.896181 1469.885439 92046.283
1990 4979.033305 5658.858544 6450.602630 7965.990817 7305.122202 6546.142695 6088.997657 8302.655551 7112.353326 6256.978761 5765.087556 4837.430019 3579.942889 2645.348003 2097.413525 1982.825069 94545.802
1995 4695.509592 4992.543849 5655.103506 6714.695212 8263.136563 7255.490131 6563.458282 6965.980397 8295.441941 7056.728925 6168.395943 5587.206829 4598.497619 3301.075793 2283.778307 2645.498107 97116.988
2000 4680.580629 4662.655666 4990.225521 5872.061611 6966.320590 8142.136645 7223.957729 6053.012444 6904.507442 8157.967161 6900.375591 5989.931442 5311.747082 4248.787547 2929.755323 3317.451069 98872.893
2005 4889.537224 5047.886802 5104.926732 5643.287573 6659.471615 7468.481973 8666.933188 6981.296824 6590.946914 7505.524676 8655.701898 7282.624379 6261.534519 5481.240761 4252.514847 4987.842536 109173.975
2010 4912.600921 5066.374379 5346.954677 5491.413348 6258.390565 6833.589342 7662.515927 7968.797237 7234.096580 6879.245574 7821.580560 8856.451177 7458.734057 6244.727984 5254.318256 7057.714673 115282.491
2015 5017.077052 5049.572348 5229.612891 5582.693576 5782.857688 6472.248982 7044.525622 9155.711597 8098.324215 7315.545530 6982.318406 7946.077790 8841.974562 7223.399903 5798.666958 9141.365725 118572.468

Next, let's draw a picture to see the specific situation

In [323]:
def aging_dist_curve(location, area, time, age, data):
    
    hash_x = ['00-04', '05-09', '10-14', '15-19', '20-24', '25-29', '30-34', '40-44', 
              '45-49', '50-54', '55-59', '60-64', '65-69', '70-74', '75-79', '80+']
    age_start = age[0]
    age_end = age[-1]
    
    x = hash_x[hash_x.index(age_start): hash_x.index(age_end)+1]
    
    y = []
    hash_area = ['Rural', 'Total', 'Urban']
    hash_time = [str(i) for i in list(range(1980, 2015+5, 5))]
    
    for l in location:
        for a in area:
            for t in time:
                y_lat = [round(data.loc[l].values.tolist()[hash_area.index(a)*8 + hash_time.index(t)][i] / 
                               data.loc[l].values.tolist()[hash_area.index(a)*8 + hash_time.index(t)][-1], 4) 
                         for i in range(hash_x.index(age_start), hash_x.index(age_end)+1)]
                y.append(y_lat)
                
    c = (Line()
        .set_global_opts(
            tooltip_opts = opts.TooltipOpts(
                is_show = True, 
                trigger = 'axis',
            ),
            xaxis_opts = opts.AxisOpts(type_ = 'category'),
            yaxis_opts = opts.AxisOpts(type_ = 'value')
        )
        .add_xaxis(xaxis_data = x))
        
    for i, y_i in enumerate(y):
        (c
            .add_yaxis(
                series_name = location[i // (len(area)+len(time))] 
                    + '-'
                    + area[(i % (len(area)+len(time))) // len(time)] 
                    + '-'
                    + time[(i % (len(area)+len(time))) % len(time)],
                y_axis = y_i,
                label_opts = opts.LabelOpts(is_show = False)
            ))
            
    return c
                
    
In [324]:
c_dist = aging_dist_curve(['China'], ['Urban', 'Rural'], ['2015', '1985'], ['00-04', '80+'], aging_dist)
c_dist.render_notebook()
Out[324]:

In 1985, the age distribution of rural and urban areas in China was relatively consistent.

In 2015, the proportion of the elderly increased and the proportion of children decreased,

it is obvious that there are more young people in cities and more old people in rural areas.

How to rationalize age distribution is a problem.

In [329]:
j_dist = aging_dist_curve(['Japan'], ['Urban', 'Rural'], ['2015', '1980'], ['00-04', '80+'], aging_dist)
j_dist.render_notebook()
Out[329]:
In [331]:
g_dist = aging_dist_curve(['Germany'], ['Urban', 'Rural'], ['2015', '1980'], ['00-04', '80+'], aging_dist)
g_dist.render_notebook()
Out[331]:

Janpan and Germany is the first and second most aging country in the world,

and the proportion of the elderly is significantly higher than that of China

In [332]:
t_dist = aging_dist_curve(["More developed regions",
         "Least developed countries"], ['Urban','Rural'], ['2015','1980'], ['00-04', '80+'], aging_dist)
t_dist.render_notebook()
Out[332]:

There are more senior citizens in developed countries,

less senior citizens and more children in underdeveloped countries.

The Gender Ratio

In [333]:
gender = (
    datas
    .reset_index()
    .pivot_table(index=["Year","Sex"], columns="LocationName", values="Total")
)
gender
Out[333]:
LocationName Afghanistan Africa Albania Algeria American Samoa Andorra Angola Anguilla Antigua and Barbuda Argentina ... Viet Nam Wallis and Futuna Islands Western Africa Western Asia Western Europe Western Sahara World Yemen Zambia Zimbabwe
Year Sex
1980 Female 4318.727333 160004.983333 888.802000 6446.278000 10.662000 11.054000 2587.265333 2.303333 24.029333 9501.424667 ... 18645.439333 3.705333 45455.865333 37550.003333 59191.926667 46.548000 1.474806e+06 2695.914667 1962.147333 2443.164000
Male 4468.226667 158967.996000 934.382000 6537.191333 10.975333 12.988000 2504.162000 2.162000 22.838000 9245.332000 ... 17952.818667 3.782667 45876.272667 38149.517333 55027.100667 54.033333 1.491227e+06 2575.403333 1936.013333 2416.215333
1985 Female 3754.215333 183741.164667 1000.489333 7551.522000 12.807333 13.932000 3065.923333 2.295333 22.589333 10278.320000 ... 20915.040000 4.438000 52169.356000 43192.138000 59793.644000 57.116000 1.611151e+06 3269.180667 2296.683333 2967.245333
Male 3931.769333 182822.692000 1051.464000 7680.102667 13.357333 15.799333 2976.507333 2.146000 21.240000 9948.626000 ... 20190.521333 4.584667 52622.582667 44153.929333 55613.510000 64.498000 1.631250e+06 3165.028000 2262.244667 2939.642000
1990 Female 3806.994667 210459.271333 1120.574000 8656.730000 15.258000 17.029333 3497.577333 2.793333 21.375333 11078.128000 ... 23345.090000 4.624000 59613.342000 48673.341333 60846.088667 68.788000 1.760802e+06 3970.336000 2634.827333 3502.952667
Male 4013.800667 209532.047333 1177.347333 8836.408667 16.104667 19.311333 3391.652000 2.762667 19.895333 10671.788000 ... 22594.832000 4.629333 60170.228667 50152.609333 57144.138000 75.764000 1.786409e+06 3889.830000 2594.850000 3471.568667
1995 Female 5738.666667 239364.112000 1106.889333 9673.002667 17.213333 20.132000 4098.069333 3.284667 23.476667 11837.552667 ... 25722.717333 4.762667 68117.522667 54306.054000 62382.800667 81.056667 1.899263e+06 4937.012000 2964.933333 3906.594667
Male 5985.382000 238305.974667 1131.682667 9870.639333 18.036000 22.437333 3971.898667 3.253333 22.089333 11384.559333 ... 24957.311333 4.666000 68828.768667 56468.108667 59091.020667 87.811333 1.928618e+06 5075.122000 2929.292000 3852.981333
2000 Female 6744.332667 269848.722667 1103.970667 10460.362667 18.762000 20.974000 4705.198667 3.744000 27.491333 12553.784667 ... 27373.415333 4.833333 77427.042000 60269.883333 63101.577333 97.060000 2.027485e+06 5774.849333 3380.488667 4197.236667
Male 6985.907333 269020.835333 1099.328000 10685.936667 19.586000 22.625333 4578.088000 3.636667 24.274000 12048.260000 ... 26551.837333 4.831333 78441.550667 62065.366667 59925.706667 106.683333 2.057649e+06 5906.842000 3353.498667 4138.531333
2005 Female 8124.601333 304196.310667 1061.858667 11200.038000 19.334667 25.804667 5577.074000 4.261333 28.758667 13159.482000 ... 28744.817333 4.760667 88143.125333 66713.788000 64333.790667 134.502000 2.154663e+06 6647.628000 3834.680667 4282.012667
Male 8449.302000 303488.802000 1068.894667 11440.564000 20.076667 28.344000 5452.510000 4.163333 26.284667 12605.754000 ... 27887.084000 4.736667 89428.794667 70127.164667 61176.128667 150.686000 2.188066e+06 6778.812667 3812.000667 4191.713333
2010 Female 9322.180000 343948.270000 1045.177333 12213.640667 18.333333 25.435333 6576.864667 4.629333 30.388667 13747.272667 ... 30051.390000 4.534000 100867.051333 74225.139333 65027.472000 162.401333 2.287167e+06 7521.761333 4414.215333 4423.864667
Male 9609.694667 343440.840667 1054.918000 12494.906000 18.757333 26.502667 6455.884667 4.549333 27.766667 13168.876667 ... 29313.541333 4.509333 102525.058000 80221.891333 62051.267333 180.697333 2.323622e+06 7653.577333 4397.108000 4294.120667
2015 Female 10522.397333 388566.660667 1065.007333 13398.476000 18.427333 26.610667 7666.132667 4.906000 31.952667 14346.528667 ... 31485.550667 4.386000 115432.534667 80882.534000 65684.301333 191.421333 2.421065e+06 8443.296667 5188.309333 5068.007333
Male 10815.461333 388926.210000 1066.313333 13690.500000 18.598000 27.356000 7547.151333 4.836667 29.262000 13756.747333 ... 30772.202667 4.382667 117756.148000 88761.884667 62974.310000 211.444000 2.462123e+06 8580.094000 5158.093333 4962.727333

16 rows × 264 columns

In [335]:
x_g=gender.loc[pd.IndexSlice[:, ["Female"]], :]
y_g=gender.loc[pd.IndexSlice[:, ["Male"]], :]
female=x_g.mean(axis=0)
male=y_g.mean(axis=0)
z_g=female/male
z_g["China"]
Out[335]:
0.9348049380175202
In [336]:
labels='Men','Women'
sizes=female['China'],male['China']
colors='lightgreen','gold'
explode=0,0
plt.pie(sizes,explode=explode,labels=labels,
        colors=colors,autopct='%1.1f%%',shadow=True,startangle=50)
plt.axis('equal')
plt.show()
ax.set_title("Proportion of women and men population in China ")
Out[336]:
Text(0.5, 1, 'Proportion of women and men population in China ')
In [337]:
print("The country with the largest share of women is",z_g.idxmax())
The country with the largest share of women is Latvia
In [338]:
labels='Women','Men'
sizes=female['Latvia'],male['Latvia']
colors='lightskyblue','lightcoral'
explode=0,0
plt.pie(sizes,explode=explode,labels=labels,
        colors=colors,autopct='%1.1f%%',shadow=True,startangle=50)
plt.axis('equal')
plt.show()
ax.set_title("Proportion of women and men population in Latvia ")
Out[338]:
Text(0.5, 1, 'Proportion of women and men population in Latvia ')
In [339]:
print("The country with the largest share of men is",z_g.idxmin())
The country with the largest share of men is Qatar
In [340]:
labels='Women','Men'
sizes=female['Qatar'],male['Qatar']
colors='lightskyblue','lightcoral'
explode=0,0
plt.pie(sizes,explode=explode,labels=labels,
        colors=colors,autopct='%1.1f%%',shadow=True,startangle=50)
plt.axis('equal')
plt.show()
ax.set_title("Proportion of women and men population in Latvia ")
Out[340]:
Text(0.5, 1, 'Proportion of women and men population in Latvia ')

Finally,

based on the above analysis, we have a rough understanding of the basic situation of the data set population.

What should we do?

As a Chinese, under the guidance of the party and the state,

we should also make efforts for

  • China's urbanization
  • urban and rural population distribution balance
  • gender ratio coordination

match the national policies, and make bold suggestions to contribute to the socialist modernization.