A Python package for the life sciences to conduct hypothesis testing from CSV files.
Project description
csv-stats
Python package for rapid hypothesis testing on CSV files with data in long table format, which are common in the life sciences. Test results are saved to PDF as a rendered JSON string, or can be returned as a Python dictionary.
Installation
pip install csv-stats
Examples
All code examples below use the following constants:
DATA_PATH = "path/to/data.csv" # Path to your CSV file
DATA_COLUMN = 'values' # The column to run the hypothesis tests on
GROUP_COLUMN = 'groups' # Grouping variable (i.e. statistical factor)
REPEATED_MEASURES_COLUMN = 'subject_id' # Column indicating repeated measures (e.g. subject IDs)
ANOVA
One way ANOVA is currently supported. They include tests of homogeneity of variance and normality of residuals. Repeated measures ANOVA is also supported, including tests of sphericity.
NOTE: Two- and three-way ANOVA support is planned, but not yet implemented.
from csv_stats.anova import anova1way
# One way ANOVA, independent samples
result_anova1way = anova1way(DATA_PATH,
GROUP_COLUMN,
DATA_COLUMN,
filename = "anova1way_results.pdf", # Default save name. Enter `None` to not save.
render_plot = False # For speed, by default no plots are generated
)
# One way ANOVA, repeated measures
result_anova1way_rm = anova1way(DATA_PATH,
GROUP_COLUMN,
DATA_COLUMN,
repeated_measures_column = REPEATED_MEASURES_COLUMN,
filename = "anova1way_results.pdf", # Default save name. Enter `None` to not save.
render_plot = False # For speed, by default no plots are generated
)
t-test
Both independent samples (one and two samples) and paired samples t-tests are supported. They include tests of homogeneity of variance and normality of residuals.
from csv_stats.ttest import ttest_ind, ttest_dep
# Independent samples t-test
# Two sample when the GROUP_COLUMN has two groups
# One smaple when the GROUP_COLUMN has one group
result_ttest_ind = ttest_ind(DATA_PATH,
GROUP_COLUMN,
DATA_COLUMN,
popmean = 0, # Test against a population mean of 0 (default)
filename = "ttest_ind_results.pdf", # Default save name. Enter `None` to not save.
render_plot = False # For speed, by default no plots are generated
)
# Paired samples t-test
result_ttest_rel = ttest_dep(DATA_PATH,
GROUP_COLUMN,
DATA_COLUMN,
repeated_measures_column = REPEATED_MEASURES_COLUMN,
filename = "ttest_dep_results.pdf", # Default save name. Enter `None` to not save.
render_plot = False # For speed, by default no plots are generated
)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csv_stats-0.1.3.tar.gz.
File metadata
- Download URL: csv_stats-0.1.3.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65957ccd5dd2ff15aac5289fc783d5a49b2277b5dce3de33641cbc24962f61b0
|
|
| MD5 |
f90ffed94122a95d2d233f09c98f0d8d
|
|
| BLAKE2b-256 |
abcc16feb1080b1c9c5c0985ddb91c5ff4ada8096fe1283694f6885123b8b0d2
|
File details
Details for the file csv_stats-0.1.3-py3-none-any.whl.
File metadata
- Download URL: csv_stats-0.1.3-py3-none-any.whl
- Upload date:
- Size: 2.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1235ae5d2e7c955d1b734012291d7a99f1018195c0e73ada033bb7ec48e41fc4
|
|
| MD5 |
0513d7c9abfce18b43cb5f18f2e9f606
|
|
| BLAKE2b-256 |
d83745d6b9a76b0a32b14bbd1582f729b1991f6b6794827f5860ae108c808472
|