fishersapi
A package for applying a fast implementation of Fisher's exact test to observations in a pandas DataFrame.
Contingency tables are computed based on all pairs of columns in cols and all pairs of unique values within the columns. The results are tested against scipy.stats.fishers_exact and fallback on scipy if numba is not avilable.
Installation
The package is compatible with Python 3 and can be installed from PyPI or cloned and installed directly.
pip install fishersapi
Example
import fishersapi
a = np.random.randint(1, 50, size=n)
b = np.random.randint(1, 50, size=n)
c = np.random.randint(1, 100, size=n)
d = np.random.randint(1, 100, size=n)
ORs, pvalues = fishersapi.fishers_vec(a, b, c, d, alternative='two-sided')
n = 50
df = pd.DataFrame({'VA':np.random.choice(['TRAV14', 'TRAV12', 'TRAV3', 'TRAV23', 'TRAV11', 'TRAV6'], n),
'JA':np.random.choice(['TRAJ4', 'TRAJ2', 'TRAJ3','TRAJ5', 'TRAJ21', 'TRAJ13'], n),
'VB':np.random.choice(['TRBV14', 'TRBV12', 'TRBV3', 'TRBV23', 'TRBV11', 'TRBV6'], n),
'JB':np.random.choice(['TRBJ4', 'TRBJ2', 'TRBJ3','TRBJ5', 'TRBJ21', 'TRBJ13'], n)})
df = df.assign(Count=1)
df.loc[:10, 'Count'] = 15
res = fishersapi.fishers_frame(df, ['VA', 'JA', 'VB', 'JB'], count_col=None, alternative='two-sided')
Release files for fishersapi 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fishersapi-1.0.tar.gz | 12.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fishersapi-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.7 kB
Release files / fishersapi-1.0.tar.gz
| Download URL | fishersapi-1.0.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1c294e00376d6af3f9f98a51b1425546717cd85ef7f66da96ba608a56460df4
|
|
BLAKE2b-256 checksum How to use checksums |
9794869110c39930d1ba32dda863ca07f6d383290c6017de165b9ef5d7bbe466
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.5
|
Release files / fishersapi-1.0-py3-none-any.whl
| Download URL | fishersapi-1.0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ffcbbc41fe8411675e5a1cc2a09f655f5311b8d4b22afd64054a8120ef483451
|
|
BLAKE2b-256 checksum How to use checksums |
db08a88d5b618bf2ae23f806403a803791655f9794b140f7f2b0c9a5251230d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.5
|