Skip to main content
https://travis-ci.org/appeler/outkast.svg?branch=master https://ci.appveyor.com/api/projects/status/uh8be9gytjo88d6f/branch/master?svg=true https://img.shields.io/pypi/v/outkast.svg https://pepy.tech/badge/outkast

Using data on more than 420M Indians from the Socio-Economic Caste Census (parsed data here), we estimate the proportion lower-caste for a particular last name, year, and state.

Why?

We provide this package so that people can find ways to assess, highlight, and fight unfairness.

How is the underlying data produced?

We split name into first name and last name and then aggregated per state, year.

This is used to provide the base prediction.

Base Classifier

We start by providing a base model for last_name that gives the Bayes optimal solution providing the proportion of SC, ST, and Other with that last name. We also provide a series of base models where the state of residence is known.

Installation

We strongly recommend installing outkast inside a Python virtual environment (see venv documentation)

pip install outkast

Usage

usage: secc_caste [-h] -l LAST_NAME
                [-s {arunachal pradesh,assam,bihar,chhattisgarh,gujarat,haryana,kerala,madhya pradesh,maharashtra,mizoram,odisha,nagaland,punjab,rajasthan,sikkim,tamilnadu,uttar pradesh,uttarakhand,west bengal}]
                [-y YEAR] [-o OUTPUT]
                input

Appends SECC 2011 data columns for sc, st, and other by last name

positional arguments:
input                 Input file

optional arguments:
-h, --help            show this help message and exit
-l LAST_NAME, --last-name LAST_NAME
                        Name or index location of column contains the last
                        name
-s {arunachal pradesh,assam,bihar,chhattisgarh,gujarat,haryana,kerala,madhya pradesh,maharashtra,mizoram,odisha,nagaland,punjab,rajasthan,sikkim,tamilnadu,uttar pradesh,uttarakhand,west bengal}, --state {arunachal pradesh,assam,bihar,chhattisgarh,gujarat,haryana,kerala,madhya pradesh,maharashtra,mizoram,odisha,nagaland,punjab,rajasthan,sikkim,tamilnadu,uttar pradesh,uttarakhand,west bengal}
                        State name of SECC data (default=all)
-y YEAR, --year YEAR  Birth year in SECC data (default=all)
-o OUTPUT, --output OUTPUT
                        Output file with SECC data columns

Using outkast

>>> import pandas as pd
>>> from outkast import secc_caste
>>>
>>> names = [{'name': 'patel'},
...          {'name': 'kohli'},
...          {'name': 'lal'},
...          {'name': 'agarwal'}]
>>>
>>> df = pd.DataFrame(names)
>>>
>>> secc_caste(df, 'name')
    name     n_sc    n_st  n_other   prop_sc   prop_st  prop_other
0    patel    17043  336909  1894248  0.007581  0.149857    0.842562
1    kohli      468      57      552  0.434540  0.052925    0.512535
2      lal  2111632  725713  3943494  0.311412  0.107024    0.581564
3  agarwal      117      36    13125  0.008812  0.002711    0.988477
>>>
>>> help(secc_caste)
Help on method secc_caste in module outkast.secc_caste_ln:

secc_caste(df, namecol, state=None, year=None) method of builtins.type instance
    Appends additional columns from SECC data to the input DataFrame
    based on the last name.

    Removes extra space. Checks if the name is the SECC data.
    If it is, outputs data from that row.

    Args:
        df (:obj:`DataFrame`): Pandas DataFrame containing the last name
            column.
        namecol (str or int): Column's name or location of the name in
            DataFrame.
        state (str): The state name of SECC data to be used.
            (default is None for all states)
        year (int): The year of SECC data to be used.
            (default is None for all years)

    Returns:
        DataFrame: Pandas DataFrame with additional columns:-
            'n_sc', 'n_st', 'n_other',
            'prop_sc', 'prop_st', 'prop_other' by last name

Authors

Suriyan Laohaprapanon and Gaurav Sood

License

The package is released under the MIT License.

Metadata

Release files for outkast 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for outkast 0.1.0
File Size Uploaded
outkast-0.1.0.tar.gz 25.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for outkast 0.1.0
File Interpreter ABI Platform
outkast-0.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 51.2 MB

Release files / outkast-0.1.0.tar.gz

Download URL outkast-0.1.0.tar.gz
Size 25.6 MB
Tags Source
SHA-256 checksum
How to use checksums
9bf450fcec422d410599a01b37ba7fcd4e60adfdbe63210cc273c525691cd972
BLAKE2b-256 checksum
How to use checksums
50aa820737dc4e41524248eafaaf3b43d43252fe0c1eff5f9ae3aa2985f84d17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.5.2

Release files / outkast-0.1.0-py2.py3-none-any.whl

Download URL outkast-0.1.0-py2.py3-none-any.whl
Size 25.6 MB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c2aa4e2d51e0b64875cbae0546efd18eb09dcc922a6da4dd015ba1a63d55bbca
BLAKE2b-256 checksum
How to use checksums
3da79980bbb70a2fb5c343655065394e42f0a77e0f4851432c935184d4fdbb62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.5.2

Release history Release notifications | RSS feed

2.0.1

2 release files

1.0.0

2 release files

0.2.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page