Skip to main content

HypoTestX

Natural Language Hypothesis Testing for Python

Python 3.8+ License: MIT Version Tests

Ask a statistical question in plain English. Get a structured result back — with the right test chosen automatically.


The problem with scipy

# scipy — you decide the test, extract groups, interpret results yourself
from scipy import stats
males = df[df['gender'] == 'M']['salary'].values
females = df[df['gender'] == 'F']['salary'].values
t, p = stats.ttest_ind(males, females, equal_var=False)
# p = 0.0012 ... now what?
# HypoTestX — ask the question, get a full result
import hypotestx as hx
result = hx.analyze(df, "Do males earn more than females?")
print(result.summary())
[ Welch's t-test (unequal variances) ]
=============================================
Statistic (t):   3.2456
p-value:         0.0012
Significant:     Yes (alpha = 0.05)
Effect size (d): 0.6834   (medium)
95% CI:          [1.23, 4.56]

Install

pip install hypotestx

No mandatory dependencies — pure Python stdlib for all math and HTTP calls.


Usage

Natural language (no API key needed)

import hypotestx as hx
import pandas as pd

df = pd.read_csv('data.csv')

result = hx.analyze(df, "Is there a correlation between age and salary?")
result = hx.analyze(df, "Did scores improve from pre_score to post_score?")
result = hx.analyze(df, "Are gender and department independent?")
result = hx.analyze(df, "Compare satisfaction scores across all regions")

With a real LLM backend (better accuracy on complex questions)

# Google Gemini — free tier, 1500 req/day
result = hx.analyze(df, "...", backend="gemini", api_key="AIza...")

# Groq — free tier, very fast
result = hx.analyze(df, "...", backend="groq", api_key="gsk_...")

# Local Ollama — completely offline, no API key
result = hx.analyze(df, "...", backend="ollama")

Direct API (explicit control)

result = hx.ttest_2samp(group1, group2, equal_var=False, alpha=0.01)
result = hx.pearson(x, y, alternative='greater')
result = hx.chi2_test(contingency_table)
result = hx.mannwhitney(group1, group2)

Result object

result.p_value            # 0.0012
result.is_significant     # True
result.effect_size        # 0.6834
result.effect_magnitude   # 'medium'
result.confidence_interval # (1.23, 4.56)
result.interpretation     # plain-English explanation
result.summary()          # formatted summary string
result.to_dict()          # dict for logging or serialization

Supported tests

Parametric: one-sample t-test, two-sample t-test, Welch's t-test, paired t-test, one-way ANOVA

Non-parametric: Mann-Whitney U, Wilcoxon signed-rank, Kruskal-Wallis

Categorical: chi-square (independence + GoF), Fisher's exact

Correlation: Pearson, Spearman, point-biserial

Plus: assumption checking, effect sizes, power analysis, bootstrap & permutation tests, HTML/PDF reporting


Links

Metadata

Release files for hypotestx 1.0.6

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

Source distribution (sdist)

Source distribution for hypotestx 1.0.6
File Size Uploaded
hypotestx-1.0.6.tar.gz 137.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hypotestx 1.0.6
File Interpreter ABI Platform
hypotestx-1.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 268.5 kB

Release files / hypotestx-1.0.6.tar.gz

Download URL hypotestx-1.0.6.tar.gz
Size 137.4 kB
Tags Source
SHA-256 checksum
How to use checksums
451df3abf6215d54f810b50d79cd7645ac329da17635457f00fdc5bc5fdbb2e3
BLAKE2b-256 checksum
How to use checksums
f8e5935aa25ddf67855471b2ffdea6a974b9894c3af7d63188d9507a2d1cc1c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / hypotestx-1.0.6-py3-none-any.whl

Download URL hypotestx-1.0.6-py3-none-any.whl
Size 131.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce73be7b403f8f535a87103dca2895047844a5935ced4679f5eac7bae8eeb3b9
BLAKE2b-256 checksum
How to use checksums
c9072cc9aeea64fe3533fba949f6890c0c73620bdc4b621acce18a5703d97c7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.6 This release

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.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