From 2b5bc1c0dbed5bb0d36af72539f5bd8f60a03cdd Mon Sep 17 00:00:00 2001 From: Jeffrey Post <jeffrey.post@etu.unige.ch> Date: Tue, 10 Nov 2020 19:55:08 +0000 Subject: [PATCH] Religions notebook Jupyter notebook wrangling religious data from data.world --- notebooks/religions.ipynb | 614 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 614 insertions(+) create mode 100644 notebooks/religions.ipynb diff --git a/notebooks/religions.ipynb b/notebooks/religions.ipynb new file mode 100644 index 0000000..3158802 --- /dev/null +++ b/notebooks/religions.ipynb @@ -0,0 +1,614 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: datadotworld in /opt/conda/lib/python3.7/site-packages (1.7.0)\n", + "Requirement already satisfied: tableschema<2.0a,>=1.5.2 in /opt/conda/lib/python3.7/site-packages (from datadotworld) (1.20.0)\n", + "Requirement already satisfied: click<7.0a,>=6.0 in /opt/conda/lib/python3.7/site-packages (from datadotworld) (6.7)\n", + "Requirement already satisfied: python-dateutil<3.0a,>=2.6.0 in /opt/conda/lib/python3.7/site-packages (from datadotworld) (2.8.1)\n", + "Requirement already satisfied: certifi>=2017.04.17 in /opt/conda/lib/python3.7/site-packages (from datadotworld) (2020.4.5.1)\n", + "Requirement already satisfied: datapackage<2.0a,>=1.6.2 in /opt/conda/lib/python3.7/site-packages (from datadotworld) (1.15.1)\n", + "Requirement already satisfied: configparser<4.0a,>=3.5.0 in /opt/conda/lib/python3.7/site-packages (from datadotworld) (3.8.1)\n", + "Requirement already satisfied: tabulator>=1.22.0 in /opt/conda/lib/python3.7/site-packages (from datadotworld) (1.53.0)\n", + "Requirement already satisfied: urllib3<2.0a,>=1.15 in /opt/conda/lib/python3.7/site-packages (from datadotworld) (1.25.9)\n", + "Requirement already satisfied: requests<3.0a,>=2.0.0 in /opt/conda/lib/python3.7/site-packages (from datadotworld) (2.23.0)\n", + "Requirement already satisfied: six<2.0a,>=1.5.0 in /opt/conda/lib/python3.7/site-packages (from datadotworld) (1.14.0)\n", + "Requirement already satisfied: jsonschema>=2.5 in /opt/conda/lib/python3.7/site-packages (from tableschema<2.0a,>=1.5.2->datadotworld) (3.2.0)\n", + "Requirement already satisfied: unicodecsv>=0.14 in /opt/conda/lib/python3.7/site-packages (from tableschema<2.0a,>=1.5.2->datadotworld) (0.14.1)\n", + "Requirement already satisfied: isodate>=0.5.4 in /opt/conda/lib/python3.7/site-packages (from tableschema<2.0a,>=1.5.2->datadotworld) (0.6.0)\n", + "Requirement already satisfied: rfc3986>=1.1.0 in /opt/conda/lib/python3.7/site-packages (from tableschema<2.0a,>=1.5.2->datadotworld) (1.4.0)\n", + "Requirement already satisfied: cached-property>=1.5 in /opt/conda/lib/python3.7/site-packages (from tableschema<2.0a,>=1.5.2->datadotworld) (1.5.2)\n", + "Requirement already satisfied: chardet>=3.0 in /opt/conda/lib/python3.7/site-packages (from datapackage<2.0a,>=1.6.2->datadotworld) (3.0.4)\n", + "Requirement already satisfied: jsonpointer>=1.10 in /opt/conda/lib/python3.7/site-packages (from datapackage<2.0a,>=1.6.2->datadotworld) (2.0)\n", + "Requirement already satisfied: openpyxl>=2.6 in /opt/conda/lib/python3.7/site-packages (from tabulator>=1.22.0->datadotworld) (3.0.5)\n", + "Requirement already satisfied: ijson>=3.0.3 in /opt/conda/lib/python3.7/site-packages (from tabulator>=1.22.0->datadotworld) (3.1.2.post0)\n", + "Requirement already satisfied: linear-tsv>=1.0 in /opt/conda/lib/python3.7/site-packages (from tabulator>=1.22.0->datadotworld) (1.1.0)\n", + "Requirement already satisfied: sqlalchemy>=0.9.6 in /opt/conda/lib/python3.7/site-packages (from tabulator>=1.22.0->datadotworld) (1.3.16)\n", + "Requirement already satisfied: jsonlines>=1.1 in /opt/conda/lib/python3.7/site-packages (from tabulator>=1.22.0->datadotworld) (1.2.0)\n", + "Requirement already satisfied: boto3>=1.9 in /opt/conda/lib/python3.7/site-packages (from tabulator>=1.22.0->datadotworld) (1.16.14)\n", + "Requirement already satisfied: xlrd>=1.0 in /opt/conda/lib/python3.7/site-packages (from tabulator>=1.22.0->datadotworld) (1.2.0)\n", + "Requirement already satisfied: idna<3,>=2.5 in /opt/conda/lib/python3.7/site-packages (from requests<3.0a,>=2.0.0->datadotworld) (2.9)\n", + "Requirement already satisfied: importlib-metadata; python_version < \"3.8\" in /opt/conda/lib/python3.7/site-packages (from jsonschema>=2.5->tableschema<2.0a,>=1.5.2->datadotworld) (1.6.0)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.7/site-packages (from jsonschema>=2.5->tableschema<2.0a,>=1.5.2->datadotworld) (46.1.3.post20200325)\n", + "Requirement already satisfied: pyrsistent>=0.14.0 in /opt/conda/lib/python3.7/site-packages (from jsonschema>=2.5->tableschema<2.0a,>=1.5.2->datadotworld) (0.16.0)\n", + "Requirement already satisfied: attrs>=17.4.0 in /opt/conda/lib/python3.7/site-packages (from jsonschema>=2.5->tableschema<2.0a,>=1.5.2->datadotworld) (19.3.0)\n", + "Requirement already satisfied: jdcal in /opt/conda/lib/python3.7/site-packages (from openpyxl>=2.6->tabulator>=1.22.0->datadotworld) (1.4.1)\n", + "Requirement already satisfied: et-xmlfile in /opt/conda/lib/python3.7/site-packages (from openpyxl>=2.6->tabulator>=1.22.0->datadotworld) (1.0.1)\n", + "Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /opt/conda/lib/python3.7/site-packages (from boto3>=1.9->tabulator>=1.22.0->datadotworld) (0.10.0)\n", + "Requirement already satisfied: s3transfer<0.4.0,>=0.3.0 in /opt/conda/lib/python3.7/site-packages (from boto3>=1.9->tabulator>=1.22.0->datadotworld) (0.3.3)\n", + "Requirement already satisfied: botocore<1.20.0,>=1.19.14 in /opt/conda/lib/python3.7/site-packages (from boto3>=1.9->tabulator>=1.22.0->datadotworld) (1.19.14)\n", + "Requirement already satisfied: zipp>=0.5 in /opt/conda/lib/python3.7/site-packages (from importlib-metadata; python_version < \"3.8\"->jsonschema>=2.5->tableschema<2.0a,>=1.5.2->datadotworld) (3.1.0)\n", + "\u001b[33mWARNING: You are using pip version 20.1.1; however, version 20.2.4 is available.\n", + "You should consider upgrading via the '/opt/conda/bin/python3 -m pip install --upgrade pip' command.\u001b[0m\n", + "Collecting pandas\n", + " Downloading pandas-1.1.4-cp37-cp37m-manylinux1_x86_64.whl (9.5 MB)\n", + "\u001b[K |████████████████████████████████| 9.5 MB 2.9 MB/s eta 0:00:01\n", + "\u001b[?25hCollecting numpy>=1.15.4\n", + " Downloading numpy-1.19.4-cp37-cp37m-manylinux2010_x86_64.whl (14.5 MB)\n", + "\u001b[K |████████████████████████████████| 14.5 MB 57.4 MB/s eta 0:00:01\n", + "\u001b[?25hRequirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.7/site-packages (from pandas) (2.8.1)\n", + "Collecting pytz>=2017.2\n", + " Downloading pytz-2020.4-py2.py3-none-any.whl (509 kB)\n", + "\u001b[K |████████████████████████████████| 509 kB 46.8 MB/s eta 0:00:01\n", + "\u001b[?25hRequirement already satisfied: six>=1.5 in /opt/conda/lib/python3.7/site-packages (from python-dateutil>=2.7.3->pandas) (1.14.0)\n", + "Installing collected packages: numpy, pytz, pandas\n", + "Successfully installed numpy-1.19.4 pandas-1.1.4 pytz-2020.4\n", + "\u001b[33mWARNING: You are using pip version 20.1.1; however, version 20.2.4 is available.\n", + "You should consider upgrading via the '/opt/conda/bin/python3 -m pip install --upgrade pip' command.\u001b[0m\n" + ] + } + ], + "source": [ + "!pip install datadotworld\n", + "!pip install pandas" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import datadotworld as dw" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "intermediate = dw.load_dataset('cow/world-religion-data')" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "KeysView(LazyLoadedDict({'wrp_global_data': LazyLoadedValue(<pandas.DataFrame>), 'wrp_national_data': LazyLoadedValue(<pandas.DataFrame>), 'wrp_regional_data': LazyLoadedValue(<pandas.DataFrame>)}))" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "intermediate.dataframes.keys()" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [], + "source": [ + "wrp_df = intermediate.dataframes['wrp_national_data']" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [], + "source": [ + "wrp_df.set_index('name', inplace=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>year</th>\n", + " <th>state</th>\n", + " <th>chrstprot</th>\n", + " <th>chrstcat</th>\n", + " <th>chrstorth</th>\n", + " <th>chrstang</th>\n", + " <th>chrstothr</th>\n", + " <th>chrstgen</th>\n", + " <th>judorth</th>\n", + " <th>jdcons</th>\n", + " <th>...</th>\n", + " <th>othrgenpct</th>\n", + " <th>sumreligpct</th>\n", + " <th>total</th>\n", + " <th>dualrelig</th>\n", + " <th>datatype</th>\n", + " <th>sourcereliab</th>\n", + " <th>recreliab</th>\n", + " <th>reliabilevel</th>\n", + " <th>version</th>\n", + " <th>sourcecode</th>\n", + " </tr>\n", + " <tr>\n", + " <th>name</th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>USA</th>\n", + " <td>1945</td>\n", + " <td>2</td>\n", + " <td>66069671</td>\n", + " <td>38716742</td>\n", + " <td>1121898</td>\n", + " <td>2400000</td>\n", + " <td>1956807</td>\n", + " <td>110265118</td>\n", + " <td>821489</td>\n", + " <td>1364508</td>\n", + " <td>...</td>\n", + " <td>0.0039</td>\n", + " <td>0.9961</td>\n", + " <td>1.0000</td>\n", + " <td>False</td>\n", + " <td>34</td>\n", + " <td>2</td>\n", + " <td>10</td>\n", + " <td>Medium</td>\n", + " <td>1.1</td>\n", + " <td>13</td>\n", + " </tr>\n", + " <tr>\n", + " <th>USA</th>\n", + " <td>1950</td>\n", + " <td>2</td>\n", + " <td>73090083</td>\n", + " <td>42635882</td>\n", + " <td>3045420</td>\n", + " <td>3045420</td>\n", + " <td>1177214</td>\n", + " <td>122994019</td>\n", + " <td>1078078</td>\n", + " <td>1790706</td>\n", + " <td>...</td>\n", + " <td>0.0041</td>\n", + " <td>0.9959</td>\n", + " <td>1.0000</td>\n", + " <td>False</td>\n", + " <td>34</td>\n", + " <td>6</td>\n", + " <td>28</td>\n", + " <td>Low</td>\n", + " <td>1.1</td>\n", + " <td>18</td>\n", + " </tr>\n", + " <tr>\n", + " <th>USA</th>\n", + " <td>1955</td>\n", + " <td>2</td>\n", + " <td>79294628</td>\n", + " <td>46402368</td>\n", + " <td>3454916</td>\n", + " <td>2572767</td>\n", + " <td>2277091</td>\n", + " <td>134001770</td>\n", + " <td>944000</td>\n", + " <td>1568000</td>\n", + " <td>...</td>\n", + " <td>0.0193</td>\n", + " <td>0.9807</td>\n", + " <td>0.9999</td>\n", + " <td>False</td>\n", + " <td>134</td>\n", + " <td>5</td>\n", + " <td>10</td>\n", + " <td>Medium</td>\n", + " <td>1.1</td>\n", + " <td>15</td>\n", + " </tr>\n", + " <tr>\n", + " <th>USA</th>\n", + " <td>1960</td>\n", + " <td>2</td>\n", + " <td>90692928</td>\n", + " <td>50587880</td>\n", + " <td>3334535</td>\n", + " <td>2710065</td>\n", + " <td>2908939</td>\n", + " <td>150234347</td>\n", + " <td>973500</td>\n", + " <td>1617000</td>\n", + " <td>...</td>\n", + " <td>0.0076</td>\n", + " <td>0.9924</td>\n", + " <td>0.9999</td>\n", + " <td>False</td>\n", + " <td>134</td>\n", + " <td>2</td>\n", + " <td>10</td>\n", + " <td>Medium</td>\n", + " <td>1.1</td>\n", + " <td>13</td>\n", + " </tr>\n", + " <tr>\n", + " <th>USA</th>\n", + " <td>1965</td>\n", + " <td>2</td>\n", + " <td>94165803</td>\n", + " <td>64761783</td>\n", + " <td>4792868</td>\n", + " <td>2822149</td>\n", + " <td>973155</td>\n", + " <td>167515758</td>\n", + " <td>991200</td>\n", + " <td>1646400</td>\n", + " <td>...</td>\n", + " <td>0.0030</td>\n", + " <td>0.9970</td>\n", + " <td>1.0001</td>\n", + " <td>False</td>\n", + " <td>134</td>\n", + " <td>8</td>\n", + " <td>28</td>\n", + " <td>Low</td>\n", + " <td>1.1</td>\n", + " <td>20</td>\n", + " </tr>\n", + " <tr>\n", + " <th>...</th>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " <td>...</td>\n", + " </tr>\n", + " <tr>\n", + " <th>WSM</th>\n", + " <td>1990</td>\n", + " <td>990</td>\n", + " <td>98400</td>\n", + " <td>24600</td>\n", + " <td>0</td>\n", + " <td>420</td>\n", + " <td>36080</td>\n", + " <td>159500</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>...</td>\n", + " <td>0.0008</td>\n", + " <td>0.9992</td>\n", + " <td>1.0000</td>\n", + " <td>False</td>\n", + " <td>134</td>\n", + " <td>4</td>\n", + " <td>10</td>\n", + " <td>Medium</td>\n", + " <td>1.1</td>\n", + " <td>7</td>\n", + " </tr>\n", + " <tr>\n", + " <th>WSM</th>\n", + " <td>1995</td>\n", + " <td>990</td>\n", + " <td>99000</td>\n", + " <td>26000</td>\n", + " <td>0</td>\n", + " <td>377</td>\n", + " <td>36300</td>\n", + " <td>161677</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>...</td>\n", + " <td>0.0007</td>\n", + " <td>0.9993</td>\n", + " <td>1.0001</td>\n", + " <td>False</td>\n", + " <td>134</td>\n", + " <td>5</td>\n", + " <td>20</td>\n", + " <td>Medium</td>\n", + " <td>1.1</td>\n", + " <td>1</td>\n", + " </tr>\n", + " <tr>\n", + " <th>WSM</th>\n", + " <td>2000</td>\n", + " <td>990</td>\n", + " <td>138600</td>\n", + " <td>36000</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>174600</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>...</td>\n", + " <td>0.0157</td>\n", + " <td>0.9844</td>\n", + " <td>1.0000</td>\n", + " <td>False</td>\n", + " <td>24</td>\n", + " <td>5</td>\n", + " <td>10</td>\n", + " <td>Medium</td>\n", + " <td>1.1</td>\n", + " <td>83</td>\n", + " </tr>\n", + " <tr>\n", + " <th>WSM</th>\n", + " <td>2005</td>\n", + " <td>990</td>\n", + " <td>140910</td>\n", + " <td>36600</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>177510</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>...</td>\n", + " <td>0.0159</td>\n", + " <td>0.9841</td>\n", + " <td>1.0000</td>\n", + " <td>False</td>\n", + " <td>24</td>\n", + " <td>5</td>\n", + " <td>10</td>\n", + " <td>Medium</td>\n", + " <td>1.1</td>\n", + " <td>83</td>\n", + " </tr>\n", + " <tr>\n", + " <th>WSM</th>\n", + " <td>2010</td>\n", + " <td>990</td>\n", + " <td>139757</td>\n", + " <td>35883</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>4500</td>\n", + " <td>180140</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>...</td>\n", + " <td>0.0258</td>\n", + " <td>0.9742</td>\n", + " <td>1.0000</td>\n", + " <td>False</td>\n", + " <td>24</td>\n", + " <td>5</td>\n", + " <td>10</td>\n", + " <td>Medium</td>\n", + " <td>1.1</td>\n", + " <td>83</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "<p>1995 rows × 83 columns</p>\n", + "</div>" + ], + "text/plain": [ + " year state chrstprot chrstcat chrstorth chrstang chrstothr \\\n", + "name \n", + "USA 1945 2 66069671 38716742 1121898 2400000 1956807 \n", + "USA 1950 2 73090083 42635882 3045420 3045420 1177214 \n", + "USA 1955 2 79294628 46402368 3454916 2572767 2277091 \n", + "USA 1960 2 90692928 50587880 3334535 2710065 2908939 \n", + "USA 1965 2 94165803 64761783 4792868 2822149 973155 \n", + "... ... ... ... ... ... ... ... \n", + "WSM 1990 990 98400 24600 0 420 36080 \n", + "WSM 1995 990 99000 26000 0 377 36300 \n", + "WSM 2000 990 138600 36000 0 0 0 \n", + "WSM 2005 990 140910 36600 0 0 0 \n", + "WSM 2010 990 139757 35883 0 0 4500 \n", + "\n", + " chrstgen judorth jdcons ... othrgenpct sumreligpct total \\\n", + "name ... \n", + "USA 110265118 821489 1364508 ... 0.0039 0.9961 1.0000 \n", + "USA 122994019 1078078 1790706 ... 0.0041 0.9959 1.0000 \n", + "USA 134001770 944000 1568000 ... 0.0193 0.9807 0.9999 \n", + "USA 150234347 973500 1617000 ... 0.0076 0.9924 0.9999 \n", + "USA 167515758 991200 1646400 ... 0.0030 0.9970 1.0001 \n", + "... ... ... ... ... ... ... ... \n", + "WSM 159500 0 0 ... 0.0008 0.9992 1.0000 \n", + "WSM 161677 0 0 ... 0.0007 0.9993 1.0001 \n", + "WSM 174600 0 0 ... 0.0157 0.9844 1.0000 \n", + "WSM 177510 0 0 ... 0.0159 0.9841 1.0000 \n", + "WSM 180140 0 0 ... 0.0258 0.9742 1.0000 \n", + "\n", + " dualrelig datatype sourcereliab recreliab reliabilevel version \\\n", + "name \n", + "USA False 34 2 10 Medium 1.1 \n", + "USA False 34 6 28 Low 1.1 \n", + "USA False 134 5 10 Medium 1.1 \n", + "USA False 134 2 10 Medium 1.1 \n", + "USA False 134 8 28 Low 1.1 \n", + "... ... ... ... ... ... ... \n", + "WSM False 134 4 10 Medium 1.1 \n", + "WSM False 134 5 20 Medium 1.1 \n", + "WSM False 24 5 10 Medium 1.1 \n", + "WSM False 24 5 10 Medium 1.1 \n", + "WSM False 24 5 10 Medium 1.1 \n", + "\n", + " sourcecode \n", + "name \n", + "USA 13 \n", + "USA 18 \n", + "USA 15 \n", + "USA 13 \n", + "USA 20 \n", + "... ... \n", + "WSM 7 \n", + "WSM 1 \n", + "WSM 83 \n", + "WSM 83 \n", + "WSM 83 \n", + "\n", + "[1995 rows x 83 columns]" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "wrp_df" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [], + "source": [ + "ssa_df=wrp_df.loc[['ANG', 'BEN', 'BOT', 'BFO', 'BUI', 'CAO', 'CEN', 'CHA', 'COM', 'CON', 'DRC', 'CDI', 'ERI', 'SWZ', 'ETH', 'GAB', 'GAM', 'GHA', 'GUI', 'KEN', 'LES', 'LBR', 'MAG', 'MAW', 'MLI', 'MAA', 'MZM', 'NAM', 'NIR', 'NIG', 'RWA', 'STP', 'SEN', 'SIE', 'SAF', 'SUD', 'TAZ', 'TOG', 'UGA', 'ZAM', 'ZIM']]" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": {}, + "outputs": [], + "source": [ + "ssa_df_pct = ssa_df[ssa_df.year==2010].loc[:,['chrstgenpct','judgenpct','islmgenpct','budgenpct','zorogenpct','hindgenpct','sikhgenpct','shntgenpct','bahgenpct','taogenpct','jaingenpct','confgenpct','syncgenpct','anmgenpct','nonreligpct','othrgenpct','sumreligpct']]" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([1. , 1.0001, 1.0001, 0.9999, 1. , 0.9999, 0.9999, 1.0001,\n", + " 1.0001, 0.9999, 1.0001, 1. , 1. , 0.9998, 1.0002, 0.9999,\n", + " 1. , 1. , 1. , 1. , 1.0002, 1. , 1. , 1. ,\n", + " 1.0001, 1. , 1. , 0.9999, 1. , 1. , 0.9999, 1. ,\n", + " 1. , 0.9999, 1. , 1. , 0.9999, 1. , 1. , 1. ,\n", + " 0.9999])" + ] + }, + "execution_count": 86, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ssa_df_pct.iloc[:,:-1].sum(axis=1).values" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} -- GitLab