Skip to main content

Simple python tools for survey research analysis for users of Pandas

Project description

survey_tools

This is a simple python package for survey research analysis containing convenient functions for weighted crosstabs, recoding, and weighting.

Install

You can install survey_tools with pip:

python -m pip install survey_tools

Assorted Python Functions for Survey Research

tabs - 1, 2, and 3 way tabs. Make them weighted or unweighted. Have them include NAs or not. Have them be counts or normalized by row, column, or cell.

tabs(data, 'var_name', display='column', wts='weight_var', dropna=False)

rake_weight - weight a survey to specified targets using the raking method.

rake_weight(data, df_of_proportions_to_weight_to)

recode (Similar to car::recode in R) - Select a variable and create a simple recoding string to easily recode variables.

recode(data, 'var_name', 'lo:5=1;6:10=2;11:hi=3;NaN=NaN')

get_names function - Use regex to easily select names in a given pandas.DataFrame

get_names(data, r'^[Yy]ear.+')

Future Add-ons

  1. Add CI function
  2. Stacking survey
  3. Add other weighting functions like matching, propensity weighting, or multiple combinations of these and raking.

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

survey_tools-0.1.1.tar.gz (14.2 kB view hashes)

Uploaded Source

Built Distribution

survey_tools-0.1.1-py3-none-any.whl (9.3 kB view hashes)

Uploaded Python 3

Supported by

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