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
- Add CI function
- Stacking survey
- Add other weighting functions like matching, propensity weighting, or multiple combinations of these and raking.
link I was working on: https://packaging.python.org/en/latest/tutorials/packaging-projects/
link to publish releases: https://medium.com/@blackary/publishing-a-python-package-from-github-to-pypi-in-2024-a6fb8635d45d
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file survey_tools-0.1.0.tar.gz
.
File metadata
- Download URL: survey_tools-0.1.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21300dff43706051af99e087d855123b2e6bc3603ae22cf4c7e2ece28f5aa7f0 |
|
MD5 | 651d4142e2a27bc5de009191ebeadf60 |
|
BLAKE2b-256 | 3cfe4a7f7616c08a8b755773aa3e2cba75a148ee38df929f42528d0683f385dc |
File details
Details for the file survey_tools-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: survey_tools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dc6881f5899dfa07986043559003e977c42e0f3b3012d0a6120143a3c66a8d0 |
|
MD5 | a9ef672f18b0befbad08716a02f81a5c |
|
BLAKE2b-256 | d5fc869e3d2d51594af8d6ec8ba366818dd87f05590f85bbc1387c4de2fd031b |