从印第安人的名字推断种姓

outkast的Python项目详细描述


https://travis-ci.org/appeler/outkast.svg?branch=masterhttps://ci.appveyor.com/api/projects/status/uh8be9gytjo88d6f/branch/master?svg=truehttps://img.shields.io/pypi/v/outkast.svghttps://pepy.tech/badge/outkast

利用来自19个州的1.4亿印度人的数据,我们估计了特定姓氏、年份和州的在册种姓、在册部落和其他人的比例。在

为什么?在

我们提供这套方案,以便人们能够评估、强调和抵制不公平。在

基础数据是如何产生的?在

  1. script下载发布的here的SECC的clean version。在
  2. Infer the last name
  • remove names with non-alphabetical characters
  • remove records with missing last names
  • remove < 2 char last names
  • remove rows with birth_date < 1900
  • last name shared by at least 1000
  1. Group by last name, state, and year并生成{a12}

基本分类器

我们从提供姓氏的基本模型开始,该模型给出了Bayes 提供姓氏为SC、ST和其他的比例的最优解。 我们还提供了一系列的基本模型 住所是已知的。在

安装

我们强烈建议在Python虚拟环境中安装outkast(请参见venv documentation

pip install outkast

用法

^{pr2}$

使用EHT 3>
>>> import pandas as pd
>>> from outkast import secc_caste
>>>
>>> names = [{'name': 'patel'},
...             {'name': 'zala'},
...             {'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    5681  112302   631393  0.007581  0.149861    0.842558
1     zala     667      14    34550  0.018932  0.000397    0.980670
2      lal  703595  241846  1314224  0.311371  0.107027    0.581601
3  agarwal      39      12     4375  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

作者

素里扬·拉奥哈普拉帕农和高拉夫苏德

许可证

包在MIT License下发布。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java中的图像动画GIF?   编译中的数组问题:java中csv文件拆分中的符号错误   java在maven项目中使用JDBC连接到Athena   安卓属性文件未通过java加载   macos如何强制Java应用程序登录到网络代理?   java有序二叉树,使用树排序按升序打印字符串   java如何使这个2D数组向右旋转90度?   上次修改的Java文件返回0   递归泛型/继承中的oop Java绑定不匹配   java如何在javamail api中将文件作为附件上传?   Android编程中的java:如何调用接受View类型参数的方法?   java在Spring数据JPA中嵌入对象而不是链接   需要一些将Java代码Android Studio移植到C#Visual Studio的帮助吗   java Akka Http大部分cpu时间都花在不安全的环境中。公园()   javaweb应用中的数据库角色管理   报告中未显示java Jasper映射组件   java如何使用SKMaps解决冲突依赖。广口番石榴   屏幕阅读器无法访问java QT的QWebView小部件   java无法获得第一个匹配项(与组无关)