Skip to main content

boxTestpy

boxTestpy is a beginner-friendly Python package for creating side-by-side boxplots and performing basic two-sample statistical tests (t-test or Mann–Whitney U test) with publication-ready plots. It simplifies data visualization and statistical analysis for beginners and researchers.


Features

  • Side-by-side boxplots for a two-level categorical variable
  • Normality check using Shapiro–Wilk test
  • Automatic selection of independent t-test or Mann–Whitney U test
  • Pastel color palette for clean plots
  • Optional statistical annotation on plots
  • Works with pandas DataFrames

Installation

pip install boxTestpy

For plotting support:

pip install matplotlib seaborn pandas

Quick Start

import pandas as pd
import matplotlib.pyplot as plt
import boxtestpy as btp

# Public health dataset: Blood Pressure (systolic)
data = {
    "group": ["Control"]*10 + ["Treatment"]*10,
    "blood_pressure": [
        120, 122, 118, 121, 119, 123, 117, 124, 120, 122,   # Control group
        115, 118, 116, 117, 119, 114, 116, 118, 117, 115    # Treatment group
    ]
}

df = pd.DataFrame(data)

# Side-by-side boxplot with statistical annotation
ax = btp.boxplot_side_by_side(df, group_col="group", value_col="blood_pressure")
plt.show()

# Statistical test
x = df[df["group"] == "Control"]["blood_pressure"]
y = df[df["group"] == "Treatment"]["blood_pressure"]
result = btp.compare_two_groups(x, y)
print("Statistical Test Results:", result)

# Custom pastel colors (optional)
colors = ["#f0106dff", "#adf010ff"]  # pastel red and blue

ax = btp.boxplot_side_by_side(
    df,
    group_col="group",
    value_col="blood_pressure",
    colors=colors
)
plt.show()

Functions

boxplot_side_by_side(df, group_col, value_col)

  • Creates a side-by-side boxplot for a two-level categorical variable.
  • Automatically shows a pastel-colored plot with optional statistical annotation.

compare_two_groups(x, y)

  • Performs Shapiro–Wilk normality tests on both groups.
  • Runs t-test if both groups are normal, or Mann–Whitney U test if not.
  • Returns a dictionary with test names and p-values.

License

MIT License. See LICENSE for details.


Contributing

Contributions, bug reports, and feature requests are welcome. Open an issue or pull request on GitHub.


Contributors

  • Arkaprabha Sau (Author, Creator, Maintainer)
  • Santanu Phadikar (Contributor)
  • Ishita Bhakta (Contributor)

Metadata

Release files for boxTestpy 0.2.0

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

Source distribution (sdist)

Source distribution for boxTestpy 0.2.0
File Size Uploaded
boxtestpy-0.2.0.tar.gz 5.4 kB Details

Built distribution (wheel)

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

Total release size: 10.9 kB

Release files / boxtestpy-0.2.0.tar.gz

Download URL boxtestpy-0.2.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
59997aabc85e65a00a4c66c66eedf43ba7ae4cba0f4daf1264f03cbe1912b5c0
BLAKE2b-256 checksum
How to use checksums
a03dbc12dba5f5d3fb967b36c6d68dd5075cd5cac70e21549521212af44d02cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / boxtestpy-0.2.0-py3-none-any.whl

Download URL boxtestpy-0.2.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57878d67207a349824e1e014e4d030a28779d9a2761b45fac2219b9a15067ec9
BLAKE2b-256 checksum
How to use checksums
1f440d00a3ac73326d7cb4b489d16aa6aa10be6edd87990b1a65a4b5e6ba8aae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.2.0 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