Skip to main content

Calculate some poverty and inequality measures. Based on the Wold Bank Poverty and Inequality Handbook: https://documents1.worldbank.org/curated/en/488081468157174849/pdf/483380PUB0Pove101OFFICIAL0USE0ONLY1.pdf

Project description

Poverty and Inequality Measures

Python Package to calculate some poverty and inequality measures.

Based on the Wold Bank Poverty and Inequality Handbook.

Poverty

Package includes calculations of:

  • Headcount Index: get_headcount_index (pg 68 of the Handbook)
  • Poverty Gap Index: get_poverty_gap_index (pg 70)
  • Poverty Severity Index: get_poverty_severity_index (pg 71)
  • Generic Poverty Severity Index: get_poverty_severity_index_generic (pg 72)
  • Sen Index: get_sen_index (pg 74)
  • Watts Index: get_watts_index (pg 77)
  • Time To Exit Poverty: get_time_to_exit (pg 78)

Inequality

Package includes calculations of:

  • Gini Coefficient: get_gini (pg 104)
  • Palma Ratio: get_palma (not in the handbook but defined as being the ratio between the income or expenditure of the richest decile divided by the income or expenditure of the poorest four deciles)

Installation

pip install povertyInequalityMeasures

General Usage

All methods require a data dataframe with at least two columns:

  1. target_col: The column of data that is being used to measure poverty/inequality. In most cases this is either some sort of total household/individual expenditure or income. See page 20 of the handbook for considerations of which to use.
  2. weight_col: The column that represents the weighting of each row of data. Normally, data used is survey data and therefore each row (a household or individual sureveyed) represents a given number of actual households/individuals in the population. The weight column should hold that information.

Additionally all poverty methods require a poverty line (pl) parameter, which is the amount of expenditure/income below which someone is said to be in poverty.

The time to exit method requires a growth parameter for the expected growth rate of the economy over time.

The Generic Poverty Severity Index method requires an alpha parameter, which must be greater than 0.

Examples

from povertyInequalityMeasures import poverty, inequality
import pandas as pd

Example 1

data = pd.DataFrame({'total_expenditure': [ 100,110,150,160], "weight":[1,1,1,1]})

result=poverty.get_headcount_index(125,data,"total_expenditure","weight")

print(result)
#0.5

Example 2

data = pd.DataFrame({'total_expenditure': [ 100,110,150,160], 'weight':[1,1,1,1]})
poverty_line= 125
result = poverty.get_sen_index(poverty_line, data, "total_expenditure","weight")


print(result)
#0.374

Example 3

data = pd.DataFrame({'total_expenditure': [ 100,110,150,160], 'weight':[1,1,1,1]})
poverty_line= 125
result = poverty.get_poverty_severity_index_generic(poverty_line, data, "total_expenditure","weight",2)


print(result)
#0.0136

Example 4

data = pd.DataFrame({'total_expenditure': [7,10,15,18], 'weight':[1,1,1,1]})

result = inequality.get_gini(data, "total_expenditure","weight")

print(result)
#0.19

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

povertyinequalitymeasures-1.1.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

povertyinequalitymeasures-1.1.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file povertyinequalitymeasures-1.1.1.tar.gz.

File metadata

File hashes

Hashes for povertyinequalitymeasures-1.1.1.tar.gz
Algorithm Hash digest
SHA256 82a200ec03408b6ab58947ec5b9b10046346b623f45892675f74514f2d919e41
MD5 76db77eb1ddb37ab2440c5ff17c9d5cf
BLAKE2b-256 2c6496c3ca98866cba63c194c04855faf349cdb1894506e6cf18d0433fbd45b5

See more details on using hashes here.

File details

Details for the file povertyinequalitymeasures-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for povertyinequalitymeasures-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1442d53d19931265b6abb94d8fb7c44bae7d1cff4a5af2e7042efa8b353325bc
MD5 0edb72213b4eaacbbd12a2bbdf67521e
BLAKE2b-256 f3a002f9039d7e0309a5c65327f24eeb5f9d62be0be1d5b5d1938d08de58067c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page