Skip to main content

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.

Release files for survey-tools 0.1.1

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

Source distribution (sdist)

Source distribution for survey-tools 0.1.1
File Size Uploaded
survey_tools-0.1.1.tar.gz 14.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for survey-tools 0.1.1
File Interpreter ABI Platform
survey_tools-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.4 kB

Release files / survey_tools-0.1.1.tar.gz

Download URL survey_tools-0.1.1.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6ac23c39f0267bc0a5d768a1ae5fe2e89c930d54fa5154105fd6d1881e0c3fd4
BLAKE2b-256 checksum
How to use checksums
f75b20e2564fa0b6f1386d7ca77b23fd1936b8ce0506f3b92d94052448b20ab9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / survey_tools-0.1.1-py3-none-any.whl

Download URL survey_tools-0.1.1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4c7a3c441469fffdc6cabd8948c6569e5737632c7146375ee7a67385d8e7eaf
BLAKE2b-256 checksum
How to use checksums
139df0ef04d4ba30e7f3bbdcea7b9f02311111e169682ab62975f04ae98b75cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

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