Data Visualization - World Religions -

各機能をインポートする

In [293]:
%matplotlib inline
import pandas as pd
import numpy as np
import seaborn as sns
from pandas import Series, DataFrame
from matplotlib import pyplot as plt

3つのcsvデータをダウンロードし、読み込み、表示(10行指定)、中身をみる

World Religion Map: https://www.kaggle.com/umichigan/world-religions/downloads/regional.csv/notebook

In [294]:
Global = pd.read_csv('csv/global.csv', index_col=0)
national = pd.read_csv('csv/national.csv', index_col=0)
regional = pd.read_csv('csv/regional.csv', index_col=0)
In [287]:
Global.head(10)
Out[287]:
christianity_protestant christianity_romancatholic christianity_easternorthodox christianity_anglican christianity_other christianity_all judaism_orthodox judaism_conservative judaism_reform judaism_other ... baha’i_percent taoism_percent jainism_percent confucianism_percent syncretism_percent animism_percent noreligion_percent otherreligion_percent religion_sumpercent total_percent
year
1945 160887585 391332035 98501171 36955033 13674466 701350290 856827 1426350 1929388 7796835 ... 0.0000 0.0001 0.0000 0.0000 0.2666 0.0207 0.0955 0.0061 1.012061 0.718667
1950 133301043 401935856 106610911 38307544 16324768 696480122 2204231 1860297 2528641 7105125 ... 0.0003 0.0004 0.0008 0.0012 0.1945 0.0400 0.0869 0.0055 1.011166 0.802432
1955 189347338 474378130 111661338 38177572 22437724 836002102 2496432 1653007 2225241 6611524 ... 0.0003 0.0005 0.0006 0.0012 0.1521 0.0370 0.1199 0.0084 1.011792 0.834366
1960 220293770 541957872 118268109 41846700 44601144 966967595 2818847 1716903 2300405 6892701 ... 0.0004 0.0005 0.0007 0.0012 0.1113 0.0465 0.1488 0.0065 1.013598 0.873137
1965 234437703 614115021 125954494 45086639 55119929 1074713786 3295632 1760345 2348076 6849626 ... 0.0005 0.0005 0.0007 0.0014 0.1094 0.0491 0.1446 0.0126 1.006728 0.884908
1970 247932230 671006540 134595635 46079842 76991429 1176605676 3663721 1923986 2574798 6670904 ... 0.0006 0.0005 0.0007 0.0014 0.1037 0.0457 0.1611 0.0072 1.012190 0.894433
1975 264857729 748325898 137192284 48153338 101587361 1300116609 3910099 2253657 2910930 6839862 ... 0.0006 0.0007 0.0007 0.0013 0.0926 0.0419 0.1716 0.0067 1.012114 0.903261
1980 278962191 798834729 137902427 51093360 125285902 1392078609 4300992 2439116 3153787 6713100 ... 0.0008 0.0009 0.0008 0.0013 0.0934 0.0388 0.1730 0.0082 0.977425 0.909855
1985 305061321 865316946 141435053 56651880 138453851 1506919051 4580474 2466942 3320124 6415455 ... 0.0007 0.0010 0.0008 0.0003 0.0933 0.0356 0.1688 0.0078 0.976472 0.915925
1990 391772588 928527756 147970918 63954053 162855904 1695081219 4395315 1926083 2458253 6089896 ... 0.0010 0.0011 0.0007 0.0002 0.0883 0.0343 0.1578 0.0068 1.009826 0.934234

10 rows × 75 columns

In [288]:
regional.head(10)
Out[288]:
region christianity_protestant christianity_romancatholic christianity_easternorthodox christianity_anglican christianity_other christianity_all judaism_orthodox judaism_conservative judaism_reform ... taoism_percent jainism_percent confucianism_percent syncretism_percent animism_percent noreligion_percent otherreligion_percent religion_sumpercent total_percent worldpopulation_percent
year
1945 Africa 2074180 672337 7251492 419457 4170594 14588060 0 0 0 ... 0.0000 0.0000 0.000 0.0000 0.3151 0.0003 0.0014 0.9997 1.0000 0.0180
1945 Asia 2407144 2222908 181928 3142204 1964907 9919091 0 0 0 ... 0.0002 0.0000 0.000 0.6378 0.0340 0.0462 0.0002 1.0043 1.0505 0.4103
1945 Europe 83145512 216041422 86503645 29855595 5361826 420908000 0 0 0 ... 0.0000 0.0000 0.000 0.0000 0.0023 0.1780 0.0045 0.8220 1.0000 0.3468
1945 Mideast 87174 635929 3180260 0 108332 4011695 0 0 0 ... 0.0000 0.0000 0.000 0.0000 0.0000 0.0000 0.0073 1.0000 1.0000 0.0403
1945 West. Hem 73173575 171759439 1383846 3537777 2068807 251923444 856827 1426350 1929388 ... 0.0000 0.0000 0.000 0.0190 0.0008 0.0795 0.0230 0.9377 1.0172 0.1790
1950 Africa 3302860 736193 7260770 609769 4884121 16793713 0 0 0 ... 0.0000 0.0000 0.000 0.0000 0.3288 0.0006 0.0001 0.9994 1.0000 0.0151
1950 Asia 9360004 25948053 1051829 3612715 5190796 45163397 0 0 0 ... 0.0007 0.0014 0.002 0.3274 0.0585 0.0532 0.0004 0.9791 1.0324 0.5828
1950 Europe 40293475 182146023 91004796 29739026 4534844 347718164 0 0 0 ... 0.0000 0.0000 0.000 0.0000 0.0025 0.2071 0.0011 0.7929 1.0000 0.2181
1950 Mideast 27091 946089 4047536 0 93138 5113854 1090162 6607 4404 ... 0.0000 0.0000 0.000 0.0000 0.0000 0.0000 0.0180 1.0000 1.0000 0.0348
1950 West. Hem 80317613 192159498 3245980 4346034 1621869 281690994 1114069 1853690 2524237 ... 0.0000 0.0000 0.000 0.0194 0.0014 0.0711 0.0302 0.9456 1.0168 0.1445

10 rows × 77 columns

In [289]:
national.head(10)
Out[289]:
year state buddhism_all shinto_all religion_all population
0 1945 United States of America 1601218 0 139382062 139928000
1 1950 United States of America 0 0 151652986 152271008
2 1955 United States of America 90173 0 162728815 165931000
3 1960 United States of America 2012131 0 179294703 180671000
4 1965 United States of America 1080892 0 194049012 194631000
5 1970 United States of America 1113861 0 200695751 200706000
6 1975 United States of America 1019556 0 215701628 215943000
7 1980 United States of America 1357967 0 225891446 227726000
8 1985 United States of America 1984325 0 238168864 238466000
9 1990 United States of America 1575481 59724 249744836 249907000

ランダムに中身を表示する

アメリカ以外の国も含まれていることがわかる

In [295]:
national.sample(10)
Out[295]:
state code christianity_protestant christianity_romancatholic christianity_easternorthodox christianity_anglican christianity_other christianity_all judaism_orthodox judaism_conservative ... jainism_percent confucianism_percent syncretism_percent animism_percent noreligion_percent otherreligion_percent religion_sumpercent total_percent dual_religion source_code
year
2005 Philippines PHI 4212050 68235208 0 135000 4001910 76584168 0 0 ... 0.0 0.0 0.0006 0.0235 0.0091 0.0036 0.9964 1.0000 0 99
1975 Ethiopia ETH 867513 131596 12419843 2980 1960744 15382676 0 0 ... 0.0 0.0 0.0000 0.1300 0.0001 0.0009 0.9991 1.0001 0 99
1985 Equatorial Guinea EQG 15050 269520 0 0 0 284570 0 0 ... 0.0 0.0 0.0000 0.0394 0.0200 0.0112 0.9888 1.0000 0 1
1970 United States of America USA 93918347 69119143 5498914 3030647 1300000 172867051 1088550 1808100 ... 0.0 0.0 0.0000 0.0000 0.1020 0.0001 0.9999 0.9999 0 7
1990 Mongolia MON 17310 250 1600 0 3327 22487 0 0 ... 0.0 0.0 0.0039 0.2100 0.3162 0.0008 0.9992 0.9999 0 7
1950 New Zealand NEW 654000 280000 2003 690000 233590 1859593 0 0 ... 0.0 0.0 0.0026 0.0038 0.0149 0.0008 0.9992 1.0000 0 7
1965 Myanmar MYA 1065926 242180 0 28685 0 1336791 0 0 ... 0.0 0.0 0.0031 0.1198 0.0026 0.0005 0.9995 1.0000 1 20
2005 Tunisia TUN 0 20000 0 0 5000 25000 0 0 ... 0.0 0.0 0.0000 0.0000 0.0000 0.0073 0.9927 1.0000 0 83
1980 Cape Verde CAP 8600 275280 0 0 5920 289800 0 0 ... 0.0 0.0 0.0000 0.0080 0.0074 0.0048 0.9952 1.0000 0 7
1965 Sweden SWD 7371210 35500 0 0 0 7406710 0 0 ... 0.0 0.0 0.0000 0.0000 0.0400 0.0004 0.9996 1.0000 0 99

10 rows × 78 columns

csvの国数を表示する

国名でグループすることにより、複数の国名を1つにし、count()で各行を数える

In [196]:
national.groupby(['state']).size().count()
Out[196]:
200

csvの国名を表示する

In [303]:
print(national['state'].unique())
['United States of America' 'Canada' 'Bahamas' 'Cuba' 'Haiti'
 'Dominican Republic' 'Jamaica' 'Trinidad and Tobago' 'Barbados'
 'Dominica' 'Grenada' 'St. Lucia' 'St. Vincent and the Grenadines'
 'Antigua & Barbuda' 'St. Kitts and Nevis' 'Mexico' 'Belize' 'Guatemala'
 'Honduras' 'El Salvador' 'Nicaragua' 'Costa Rica' 'Panama' 'Colombia'
 'Venezuela' 'Guyana' 'Suriname' 'Ecuador' 'Peru' 'Brazil' 'Bolivia'
 'Paraguay' 'Chile' 'Argentina' 'Uruguay' 'United Kingdom' 'Ireland'
 'Netherlands' 'Belgium' 'Luxembourg' 'France' 'Monaco' 'Liechtenstein'
 'Switzerland' 'Spain' 'Andorra' 'Portugal' 'Germany'
 'German Federal Republic' 'German Democratic Republic' 'Poland' 'Austria'
 'Hungary' 'Czechoslovakia' 'Czech Republic' 'Slovakia' 'Italy'
 'San Marino' 'Malta' 'Albania' 'Montenegro' 'Macedonia' 'Croatia'
 'Yugoslavia' 'Bosnia and Herzegovina' 'Kosovo' 'Slovenia' 'Greece'
 'Cyprus' 'Bulgaria' 'Moldova' 'Romania' 'Russia' 'Estonia' 'Latvia'
 'Lithuania' 'Ukraine' 'Belarus' 'Armenia' 'Georgia' 'Azerbaijan'
 'Finland' 'Sweden' 'Norway' 'Denmark' 'Iceland' 'Cape Verde'
 'Sao Tome and Principe' 'Guinea-Bissau' 'Equatorial Guinea' 'Gambia'
 'Mali' 'Senegal' 'Benin' 'Mauritania' 'Niger' 'Ivory Coast' 'Guinea'
 'Burkina Faso' 'Liberia' 'Sierra Leone' 'Ghana' 'Togo' 'Cameroon'
 'Nigeria' 'Gabon' 'Central African Republic' 'Chad' 'Congo'
 'Democratic Republic of the Congo' 'Uganda' 'Kenya' 'Tanzania' 'Burundi'
 'Rwanda' 'Somalia' 'Djibouti' 'Ethiopia' 'Eritrea' 'Angola' 'Mozambique'
 'Zambia' 'Zimbabwe' 'Malawi' 'South Africa' 'Namibia' 'Lesotho'
 'Botswana' 'Swaziland' 'Madagascar' 'Comoros' 'Mauritius' 'Seychelles'
 'Morocco' 'Algeria' 'Tunisia' 'Libya' 'Sudan' 'Iran' 'Turkey' 'Iraq'
 'Egypt' 'Syria' 'Lebanon' 'Jordan' 'Israel' 'Saudi Arabia'
 'Yemen Arab Republic' 'Yemen' "Yemen People's Republic" 'Kuwait'
 'Bahrain' 'Qatar' 'United Arab Emirates' 'Oman' 'Afghanistan'
 'Turkmenistan' 'Tajikistan' 'Kyrgyzstan' 'Uzbekistan' 'Kazakhstan'
 'China' 'Mongolia' 'Taiwan' 'North Korea' 'South Korea' 'Japan' 'India'
 'Bhutan' 'Pakistan' 'Bangladesh' 'Myanmar' 'Sri Lanka' 'Maldives' 'Nepal'
 'Thailand' 'Cambodia' 'Laos' 'Vietnam' 'Republic of Vietnam' 'Malaysia'
 'Singapore' 'Brunei' 'Philippines' 'Indonesia' 'East Timor' 'Australia'
 'Papua New Guinea' 'New Zealand' 'Vanuatu' 'Solomon Islands' 'Kiribati'
 'Tuvalu' 'Fiji' 'Tonga' 'Nauru' 'Marshall Islands' 'Palau'
 'Federated States of Micronesia' 'Samoa']

年代別世界の神道人口

In [152]:
Global.shinto_all.plot(kind='bar', title='世界の神道人口/年代', rot=45)
Out[152]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f17d91262e8>

世界人口からみる神道信者数

In [153]:
(Global['shinto_all'] / Global['world_population']).plot('bar', title='世界人口からみる神道信者数')
Out[153]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f17d90a0048>

読み込みで列の指定

In [281]:
national = pd.read_csv('csv/national.csv',
                 usecols=[0, 1,25,29,38,39,76],    # 使う列は 1,25,29,38,39,76列
                 index_col=1)      # indexはstateに
national.head(3)
Out[281]:
year buddhism_all shinto_all religion_all population total_percent
state
United States of America 1945 1601218 0 139382062 139928000 1.0000
United States of America 1950 0 0 151652986 152271008 1.0000
United States of America 1955 90173 0 162728815 165931000 0.9999

列の指定

In [155]:
national.head(3)[['year', 'religion_all']]
Out[155]:
year religion_all
state
United States of America 1945 139382062
United States of America 1950 151652986
United States of America 1955 162728815

行の指定

In [156]:
national['Japan':'Japan']
Out[156]:
year buddhism_all shinto_all religion_all population total_percent
state
Japan 1945 49081430 55228775 105659957 72147000 1.4646
Japan 1950 59852100 65452839 127578439 85503000 1.4922
Japan 1955 62014000 68145114 134712557 89020000 1.5133
Japan 1960 65251200 71357167 145918694 93216000 1.5654
Japan 1965 68566400 74982591 155161247 97952000 1.5840
Japan 1970 72382100 79155350 165664094 103403000 1.6021
Japan 1975 79016830 85409513 179271021 111573000 1.6068
Japan 1980 85269110 89416158 190641464 116807000 1.6321
Japan 1985 90127750 92501136 198672736 120837000 1.6442
Japan 1990 92138500 94522831 203124753 123478000 1.6451
Japan 1995 92849280 96049245 207686325 125472000 1.6552
Japan 2000 83732611 97000000 198519333 126714000 1.5667
Japan 2005 89000000 107000000 214983033 127773000 1.6825
Japan 2010 88035713 108000000 211308623 127451704 1.6578

列と行の指定

.loc['インデックスの行','列']

In [282]:
national.loc['Japan','religion_all']
Out[282]:
state
Japan    105659957
Japan    127578439
Japan    134712557
Japan    145918694
Japan    155161247
Japan    165664094
Japan    179271021
Japan    190641464
Japan    198672736
Japan    203124753
Japan    207686325
Japan    198519333
Japan    214983033
Japan    211308623
Name: religion_all, dtype: int64

日本における全宗教人口と神道+仏教人口との割合

In [158]:
df_jp = (national.loc['Japan','shinto_all'] + national.loc['Japan','buddhism_all'] / national.loc['Japan','religion_all']).sort_values(ascending=False)
df_jp.plot('bar', title='日本における全宗教人口と神道+仏教人口との割合', rot=45)
Out[158]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f17d9116da0>

インデックスを国名にして日本を摘出したことにより、インデックスに年代が表示できない

列と行の中の項目を指定することはできないのだろうか....

先生のアドバイスにより、以下のように解説

日本における全宗教人口と神道+仏教人口との割合 (解決版)

日本をloc(行ラベル)で指定し、df_jpに代入し、インデックスをset_index()で設定し、年代を指定

In [159]:
df_jp = national.loc['Japan']
df_jp = df_jp.set_index('year')
df_jp['shinto_and_buddhism_ratio'] = df_jp['shinto_all'] + df_jp['buddhism_all'] / df_jp['religion_all']
df_jp['shinto_and_buddhism_ratio'].plot('bar', title='日本における全宗教人口と神道+仏教人口との割合', rot=45)
Out[159]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f17d8f30e10>

2005年から他の宗教より神道+仏教人口が上回っていることがわかる

日本における神道+仏教人口の増加 (解決版)

日本の人口から神道+仏教人口を割って比率でみることで、人口増加の要因から離れてみることができる

In [49]:
df_jp = national.loc['Japan']
df_jp = df_jp.set_index('year')
df_jp['shinto_and_buddhism_ratio'] = df_jp['shinto_all'] + df_jp['buddhism_all'] / df_jp['population']
df_jp['shinto_and_buddhism_ratio'].plot('bar', title='日本における全宗教人口と神道+仏教人口との割合', rot=45)
Out[49]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fa573038f28>

神道+仏教人口が、2005年から人口より上回っている。

神道が文化に溶け込んでいる日本では、神道+他の宗教を支持する人が多いということだろうか。

では、人口数が宗教人口より上回っている国は他にもあるのだろうか...

人口数が宗教人口より上回っている国

In [161]:
national['total_percent'].sort_values(ascending=False)
Out[161]:
state
Cuba                                1.7277
Cuba                                1.6960
Cuba                                1.6938
Cuba                                1.6894
Cuba                                1.6890
Cuba                                1.6877
Cuba                                1.6851
Japan                               1.6825
Cuba                                1.6805
Japan                               1.6578
Japan                               1.6552
Haiti                               1.6515
Japan                               1.6451
Japan                               1.6442
Cuba                                1.6413
Japan                               1.6321
Haiti                               1.6172
Japan                               1.6068
Japan                               1.6021
Cuba                                1.5882
Japan                               1.5840
Cuba                                1.5740
Cuba                                1.5710
Japan                               1.5667
Japan                               1.5654
Japan                               1.5133
Japan                               1.4922
Haiti                               1.4806
Haiti                               1.4786
Haiti                               1.4655
                                     ...  
Zimbabwe                            0.9998
Nigeria                             0.9998
Argentina                           0.9998
Peru                                0.9998
Laos                                0.9998
Kenya                               0.9998
China                               0.9998
Iceland                             0.9998
Turkey                              0.9998
Tajikistan                          0.9998
Malaysia                            0.9998
Paraguay                            0.9998
Trinidad and Tobago                 0.9998
Thailand                            0.9998
Democratic Republic of the Congo    0.9998
Malawi                              0.9998
Norway                              0.9998
Australia                           0.9998
United Kingdom                      0.9998
Cameroon                            0.9998
Malawi                              0.9998
Ireland                             0.9998
Nepal                               0.9998
Kenya                               0.9998
South Korea                         0.9998
Kenya                               0.9998
Sri Lanka                           0.9998
South Africa                        0.9998
Sri Lanka                           0.9998
Pakistan                            0.9998
Name: total_percent, Length: 1995, dtype: float64

神道人口数をどう計算したのかは不明だが、日本以外でもCuba、Haitiがあるよう。

国別神道の年代人口ヒートマップ

TIP: index_col=1を指定するとIndex部を読み込めなくエラーが出るので、削除すること

In [300]:
national = pd.read_csv('csv/national.csv', usecols=[0, 1,25,29,38,39])
plt.figure(figsize=(27, 8))
sns.heatmap(national.pivot('year', 'state', 'shinto_all'), cmap='Blues')
Out[300]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fa56da8af28>

神道は日本のみで栄えていることがわかる

国別仏教の年代人口ヒートマップ

In [301]:
plt.figure(figsize=(27, 8))
sns.heatmap(national.pivot('year', 'state', 'buddhism_all'), cmap='Greens')
Out[301]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fa56da8a4e0>

国別だと200の国名が表示できなく、国を特定できないが日本以外でも仏教徒がいることがわかる

エリア別神道の年代人口ヒートマップ

In [163]:
regional = pd.read_csv('csv/regional.csv')
sns.heatmap(regional.pivot('year', 'region', 'shinto_all'), cmap='Blues')
Out[163]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f17d8da1278>

神道人口はアジア(日本のみ)で年々急増している > 人口増加による急増

エリア別仏教の年代人口ヒートマップ

In [176]:
sns.heatmap(regional.pivot('year', 'region', 'buddhism_all'), cmap='Greens')
Out[176]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fdb2d1a0908>

仏教人口はアジアのみで年々急増している > 人口増加による急増

日本における神道の年代人口

In [139]:
national = pd.read_csv('csv/national.csv', usecols=[0, 1,25,29,38,39])
sns.barplot(x= national.year, y= national[national.state=='Japan']['shinto_all'],palette= 'Blues')
Out[139]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f17d933ba58>

日本における仏教の年代人口

In [140]:
national = pd.read_csv('csv/national.csv', usecols=[0, 1,25,29,38,39])
sns.barplot(x= national.year, y= national[national.state=='Japan']['buddhism_all'],palette= 'Greens')
Out[140]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f17d940d0f0>

エリア別世界人口ヒートマップ

In [182]:
sns.heatmap(regional.pivot('year', 'region', 'world_population'), cmap='Reds')
Out[182]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fdb2cfc8cf8>

世界全体で人口が増加していることがわかる

エリア別宗教人口ヒートマップ

In [184]:
sns.heatmap(regional.pivot('year', 'region', 'religion_all'), cmap='Reds')
Out[184]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fdb2cd2b940>

宗教人口はなぜかアジアだけ増加していることがわかる

世界の宗教別人口数

In [93]:
Global = pd.read_csv('csv/global.csv')
cols= ['year','christianity_all','islam_all','hinduism_all','buddhism_all','noreligion_all','syncretism_all','christianity_percent','hinduism_percent','islam_percent','buddhism_percent','syncretism_percent','noreligion_percent']
Global= Global[cols]

for col in Global.columns:
    if '_all' in col:
        ax= plt.plot(Global.index, Global[col],label= col, linewidth= 3)
        plt.title('宗教別支持者数')
        plt.legend(bbox_to_anchor= (-.2,-.5,1.4,.5), mode= 'expand', loc=3,ncol=3,fontsize= 14)
        plt.xticks(size=14)
        plt.yticks(size=14)

クリスチャンが多く、人口増加で右上がり

世界の宗教相対関係

In [190]:
Global = pd.read_csv('csv/global.csv')
cols= ['christianity_all','islam_all','hinduism_all','buddhism_all','shinto_all','noreligion_all','syncretism_all']
Global= Global[cols]
plt.figure(figsize=(13, 11))
sns.heatmap(Global.corr(), square=True,  cmap='Blues', annot=True, fmt="1.1f")
plt.title('世界の宗教相対関係')
Out[190]:
Text(0.5, 1, '世界の宗教相対関係')

4大宗教のキリスト教、イスラム教、ヒンデゥー教、仏教の相対値が濃くなっている。

シンクレティズム(syncretism)は、重層信仰という意味で、日本の神仏習合(神道+仏教)の現れだが、色の変化はイスラム教より顕著でない。

世界の宗教相対関係 ver.2

人口、宗教人口、他の宗教も追加

In [191]:
Global = pd.read_csv('csv/global.csv')
cols= ['population','religion_all','christianity_all','judaism_all','islam_all','hinduism_all','buddhism_all','shinto_all','zoroastrianism_all','sikhism_all','baha’i_all','jainism_all','animism_all','noreligion_all','syncretism_all']
Global= Global[cols]
plt.figure(figsize=(13, 11))
sns.heatmap(Global.corr(), square=True,  cmap='Blues', annot=True, fmt="1.1f")
plt.title('世界の宗教相対関係 ver.2')
Out[191]:
Text(0.5, 1, '世界の宗教相対関係 ver.2')

世界の宗教相対関係 ver.3

他の記述方法

In [205]:
cols = Global.corr()
order =  ['population','religion_all','christianity_all','judaism_all','islam_all','hinduism_all','buddhism_all','shinto_all','zoroastrianism_all','sikhism_all','baha’i_all','jainism_all','animism_all','noreligion_all','syncretism_all']
cols[order]
cols_ordered = cols[order]
plt.figure(figsize=(13, 11))
sns.heatmap(cols_ordered, square=True,  cmap='Blues', annot=True, fmt="1.1f")
plt.title('世界の宗教相対関係 ver.3')
Out[205]:
Text(0.5, 1, '世界の宗教相対関係 ver.3')

世界の宗教別人口

In [276]:
regional= pd.read_csv('csv/regional.csv')
cols= ['year','population','christianity_all','judaism_all','islam_all','hinduism_all','buddhism_all','shinto_all','zoroastrianism_all','sikhism_all','baha’i_all','jainism_all','animism_all','noreligion_all','syncretism_all']
regionals= regional[cols]
regionals
Out[276]:
year population christianity_all judaism_all islam_all hinduism_all buddhism_all shinto_all zoroastrianism_all sikhism_all baha’i_all jainism_all animism_all noreligion_all syncretism_all
0 1945 29073000 14588060 80487 5051475 137290 53 0 0 1536 2021 0 9162018 7396 831
1 1945 663450000 9919091 30369 36260345 5230216 113681431 55228775 2710 12525 7243 0 22525760 30637661 423153390
2 1945 560750000 420908000 6068020 29353397 21691 725632 0 0 1748 6231 181 1294177 99829250 5896
3 1945 65219000 4011695 623240 60095064 0 0 0 10000 0 0 0 0 561 0
4 1945 289375655 251923444 5207284 0 0 1830820 0 0 5000 0 0 228125 23011662 5500000
5 1950 33707000 16793713 97006 5508523 195524 194 0 0 1943 3004 0 11084152 19918 973
6 1950 1300208016 45163397 54754 189121761 301106975 158063522 65452839 114462 5910591 453734 1816754 76081638 69193934 425681485
7 1950 486520000 347718164 5336066 30109208 44995 759624 0 0 10022 8041 500 1238087 100773236 9763
8 1950 77683000 5113854 1630211 69360805 0 0 0 5000 0 172960 0 0 0 0
9 1950 322455008 281690994 6580257 20770 2006 188562 0 0 10001 1000 0 450003 22938228 6249873
10 1955 34925000 18937318 117741 6002686 278538 707 0 0 2457 7593 0 9419390 53634 1139
11 1955 1436233000 58967413 81070 210722747 328331380 177963621 68145114 126582 6342714 738141 1619287 82851650 161895190 378770746
12 1955 603716000 441172436 5178671 33390170 93684 806776 0 0 57446 15068 1375 1189903 118537427 26391
13 1955 102730000 5654101 1966399 93953674 0 0 0 14180 0 0 0 0 270 5588
14 1955 358220000 311270834 5642323 2730 1003 613095 0 0 5000 500 0 250001 23641928 6898286
15 1960 148806000 61557803 138994 42908236 363925 3416 0 0 2971 157462 0 42355767 265053 4646
16 1960 1594029976 74184616 80005 240171009 360471285 196663980 71357167 170443 7980296 899468 2029510 89171314 278617080 317448262
17 1960 639466000 458326158 5068023 35477503 142373 853421 0 0 104871 21419 2250 1141720 133709658 37975
18 1960 128887000 5473940 2135285 116514804 0 0 0 0 0 200000 0 2800000 277 0
19 1960 409598148 367425078 6306549 51536 191584 2918342 0 0 0 0 0 300000 22037603 7525200
20 1965 219965000 98101226 147929 56667388 548874 4572 0 324 25853 557883 28913 61942649 354423 14203
21 1965 1772609960 85484649 79304 275213701 396909711 209671102 74982591 138682 8717537 1046723 2309710 94583167 305127190 350788060
22 1965 676315000 476176756 4983768 36814738 191110 900068 0 0 152295 28308 3125 1093535 147965351 49559
23 1965 159755000 6054509 2625113 145848262 0 0 0 9938 0 17627 0 2995006 47680 0
24 1965 450956507 408896646 6417565 89968 213487 2017642 0 0 0 8350 0 279349 20603206 7993000
25 1970 255537000 122086968 151537 66818285 991566 11299 0 472 26094 701507 32861 63335604 446303 17679
26 1970 2013375984 102736795 78269 318451549 448086953 226489880 79155350 106789 10441204 1177687 2590921 98686228 398889032 370782297
27 1970 703129248 488279742 4883835 38264883 242896 955963 0 410 199719 49039 4000 1047415 162011668 62146
28 1970 184476000 8264204 2584234 168490055 7470 0 0 0 0 96033 0 3326100 153410 0
29 1970 498934000 455237967 7135534 317516 495604 1345492 1000 0 19615 270712 980 613877 27337768 8294607
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
40 1985 432444000 228658879 164828 125892684 1463736 72574 0 607 37537 1074228 49895 69685451 2149016 43652
41 1985 2525823952 175024514 100490 313273334 598009426 334462502 92520741 262761 14651868 1978767 3508357 90948268 542261654 425483823
42 1985 769476405 496457481 4364409 42150125 474973 1086688 0 523 217500 72559 9648 713756 210577941 89957
43 1985 285529000 11187498 3630574 262830380 82000 35000 0 0 15000 7950 0 4265733 22000 9000
44 1985 655792000 595590679 8522694 2982068 1592400 2013925 0 0 0 46920 0 453731 33185698 10002600
45 1990 483823000 265493449 142152 135413988 1762136 100263 0 720 44358 1150689 57010 73843670 2896489 57936
46 1990 2937844992 222571100 104493 508795898 656018252 371399010 94546096 314540 18621706 2301416 3809813 103439157 561364124 459167251
47 1990 845942719 547627544 4094416 43630843 545390 1260132 0 610 228000 100313 11531 970327 236076477 243791
48 1990 337954000 16072151 3746388 308955332 318199 114686 0 500030 48899 224304 0 3276509 1641499 28966
49 1990 707106969 643316975 6782098 2884257 1205851 2373664 61724 62501 258517 1288261 6410 652668 36292691 9701954
50 1995 565658000 314790124 121360 163595753 1317227 66300 0 782 40993 1246159 61627 74918182 5092209 48635
51 1995 3228425512 259779112 195111 606168389 717365785 408209553 96076062 247242 18492938 2435313 4014448 112240465 574222830 492135244
52 1995 745952000 512007252 2565349 41542293 699215 1497063 0 731 294718 129783 13413 1232015 176181859 302461
53 1995 374116000 17023562 4638374 340695671 4791 0 0 472500 1166 278675 0 3534249 323129 0
54 1995 754990021 681814919 6552112 2988500 1481887 2182414 60945 765727 245269 757649 6684 981414 46460699 10533280
55 2000 618965000 336756649 104482 188503322 1902086 142869 0 845 53080 1083236 69013 78607573 5809663 77232
56 2000 3488405040 256892044 148450 697689629 870077984 381710232 97027500 84816 19356059 2148598 4231099 77705808 584748329 549045116
57 2000 745596883 571107445 2243767 47729841 764336 3099355 0 4782 396383 77628 15296 78139 113729094 129943
58 2000 409782300 16678853 4956077 376076983 1141268 88823 0 445000 15420 142471 0 5898000 1775785 0
59 2000 823033224 709488193 5993536 4048465 1720060 3214777 161765 1468955 232021 628141 6959 4457945 76349251 13592264
60 2005 703623000 397001958 105776 213125720 2118924 182161 0 838 61177 1082939 73053 79035014 7178005 84834
61 2005 3666155352 275275093 127286 749421842 940599251 466101118 107029655 91049 20940691 2306979 4574392 79217233 524304023 555845044
62 2005 744761600 559337643 2123463 51230517 996551 3059535 0 5105 412726 61087 17648 186360 114977698 426992
63 2005 445958853 18237497 5309425 408154695 1454979 105908 0 19500 17500 152950 0 7079400 2652435 0
64 2005 875196370 740879276 6604378 4521572 2191657 4668399 191600 1559581 437055 705878 79864 5830711 94709150 12979998
65 2010 799492401 460005841 106121 246404472 2347387 224181 0 951 74969 1183246 91857 77615288 8889456 97374
66 2010 3857553138 287921863 123356 804756836 1008830303 478920926 108029951 94666 22509620 2580737 4915980 81146609 541453380 578913544
67 2010 754067657 557677984 1378063 51222711 1125071 1556416 0 4404 490470 48120 20000 232716 130820732 548795
68 2010 491293037 19813797 5604499 448620067 2284384 142503 0 0 19000 362367 0 8025046 3612800 0
69 2010 928209348 786493468 6811270 4478680 2755503 4402911 313241 1651017 682441 665592 87304 7244680 103547575 10970832

70 rows × 15 columns

世界における無宗教人口の割合の変化(ver.1)

In [211]:
regional = pd.read_csv('csv/regional.csv')
plt.figure(figsize=(13, 8))
sns.heatmap(regional.pivot('region', 'year', 'noreligion_all'), cmap='Purples')
Out[211]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fa56e027dd8>

アジアで急激に無宗教人口が多くなっている

世界における無宗教人口の割合の変化(ver.2)

In [306]:
colormap = plt.cm.Set2
noreligion_year = regional.groupby(['year','region']).noreligion_all.sum()
noreligion_year.unstack().plot(kind='bar',stacked=True,  colormap= colormap, grid=False, figsize=(14,8) , 
                               legend=False, title='無宗教人口の割合の変化')
plt.legend(bbox_to_anchor= (-.2,-.6,1.4,.5), mode= 'expand', loc=1, ncol=5, fontsize= 14)
plt.show()

アジア(青)が一番、無宗教人口が増えている

複数の列を代入 (ver.1)

[cols]の中身は[['region'....'syncretism_all']]として[ ]も含めて代入されるため、Dataframeになる

In [311]:
cols= ['year','region','population','christianity_all','judaism_all','islam_all','hinduism_all','buddhism_all','shinto_all','zoroastrianism_all','sikhism_all','baha’i_all','jainism_all','animism_all','noreligion_all','syncretism_all']
regionals= regional[cols]
regionals
Out[311]:
year region population christianity_all judaism_all islam_all hinduism_all buddhism_all shinto_all zoroastrianism_all sikhism_all baha’i_all jainism_all animism_all noreligion_all syncretism_all
0 1945 Africa 29073000 14588060 80487 5051475 137290 53 0 0 1536 2021 0 9162018 7396 831
1 1945 Asia 663450000 9919091 30369 36260345 5230216 113681431 55228775 2710 12525 7243 0 22525760 30637661 423153390
2 1945 Europe 560750000 420908000 6068020 29353397 21691 725632 0 0 1748 6231 181 1294177 99829250 5896
3 1945 Mideast 65219000 4011695 623240 60095064 0 0 0 10000 0 0 0 0 561 0
4 1945 West. Hem 289375655 251923444 5207284 0 0 1830820 0 0 5000 0 0 228125 23011662 5500000
5 1950 Africa 33707000 16793713 97006 5508523 195524 194 0 0 1943 3004 0 11084152 19918 973
6 1950 Asia 1300208016 45163397 54754 189121761 301106975 158063522 65452839 114462 5910591 453734 1816754 76081638 69193934 425681485
7 1950 Europe 486520000 347718164 5336066 30109208 44995 759624 0 0 10022 8041 500 1238087 100773236 9763
8 1950 Mideast 77683000 5113854 1630211 69360805 0 0 0 5000 0 172960 0 0 0 0
9 1950 West. Hem 322455008 281690994 6580257 20770 2006 188562 0 0 10001 1000 0 450003 22938228 6249873
10 1955 Africa 34925000 18937318 117741 6002686 278538 707 0 0 2457 7593 0 9419390 53634 1139
11 1955 Asia 1436233000 58967413 81070 210722747 328331380 177963621 68145114 126582 6342714 738141 1619287 82851650 161895190 378770746
12 1955 Europe 603716000 441172436 5178671 33390170 93684 806776 0 0 57446 15068 1375 1189903 118537427 26391
13 1955 Mideast 102730000 5654101 1966399 93953674 0 0 0 14180 0 0 0 0 270 5588
14 1955 West. Hem 358220000 311270834 5642323 2730 1003 613095 0 0 5000 500 0 250001 23641928 6898286
15 1960 Africa 148806000 61557803 138994 42908236 363925 3416 0 0 2971 157462 0 42355767 265053 4646
16 1960 Asia 1594029976 74184616 80005 240171009 360471285 196663980 71357167 170443 7980296 899468 2029510 89171314 278617080 317448262
17 1960 Europe 639466000 458326158 5068023 35477503 142373 853421 0 0 104871 21419 2250 1141720 133709658 37975
18 1960 Mideast 128887000 5473940 2135285 116514804 0 0 0 0 0 200000 0 2800000 277 0
19 1960 West. Hem 409598148 367425078 6306549 51536 191584 2918342 0 0 0 0 0 300000 22037603 7525200
20 1965 Africa 219965000 98101226 147929 56667388 548874 4572 0 324 25853 557883 28913 61942649 354423 14203