Registry / data / statistics

statistics

JSON →
library1.0.3.5pypypi✓ verified 84d ago

This PyPI package provides a backport of the Python 3.4 `statistics` module for Python 2.x environments. It offers functions for calculating mathematical statistics of numeric (real-valued) data, mirroring the functionality introduced in Python 3.4's standard library. For Python 3.4 and newer, the `statistics` module is built directly into Python and this PyPI package is not needed and generally should not be installed.

pip install statistics
INSTALL
IMPORT
SIG · STATISTICS
S
statistics
datapythonv1.0.3.5
Install
2.7s avg
Import
26ms
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.3.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.028s · 23.5MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.7s · import 0.023s · 24MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

statistics
import statistics

Calculate basic statistics (mean, median, mode, standard deviation) from a list of numeric data. This example code uses the `statistics` module, which is built-in for Python 3.4+ and provided by the PyPI package for Python 2.x. It's assumed the appropriate version of Python (3.4+ built-in or Python 2 with the PyPI package) is in use.

import statistics data = [1.5, 2.5, 3.5, 4.5, 5.5] mean_value = statistics.mean(data) median_value = statistics.median(data) mode_value = statistics.mode(data) stdev_value = statistics.stdev(data) print(f"Mean: {mean_value}") print(f"Median: {median_value}") print(f"Mode: {mode_value}") print(f"Standard Deviation: {stdev_value}")
Debug
Known issues
breakingThe PyPI `statistics` package is a backport specifically for Python 2.x environments, mimicking Python 3.4's built-in module. It has not been updated since 2014 and Python 2.x reached End-of-Life in January 2020. Installing this package on Python 3.4+ is generally incorrect and can lead to unexpected behavior, missing features, or module conflicts, as Python 3.4+ includes the `statistics` module in its standard library.
fix
For Python 3.4 and later, *do not* `pip install statistics`. Simply `import statistics` to use the built-in standard library module.
affects: All versions of the PyPI package on Python 3.4+
gotchaThe PyPI `statistics` package only provides features up to Python 3.4's `statistics` module. If installed in a Python 3 environment, it will *shadow* the standard library module, meaning newer functions (e.g., `fmean`, `geometric_mean`, `quantiles` from Python 3.8+; `covariance`, `correlation` from Python 3.10+) will be unavailable or raise `AttributeError`.
fix
Ensure you are using the standard library `statistics` module by avoiding `pip install statistics` on Python 3. If it was installed, uninstall it with `pip uninstall statistics`.
affects: All versions of the PyPI package when used with Python 3.5+
deprecatedThis package's primary purpose was to provide `statistics` functionality to Python 2.x, which is now an unsupported and End-of-Life version of Python. Using this package means relying on an unmaintained codebase for an unsupported Python version.
fix
Migrate your project to Python 3.4+ and use its built-in `statistics` module.
affects: All versions
Errors
Common errors & fixes
AttributeError: module 'statistics' has no attribute 'fmean'
You have likely installed the PyPI `statistics` backport on a Python 3 environment, which only includes features up to Python 3.4's standard library module. `fmean` was introduced in Python 3.8.
fix
Uninstall the PyPI package: `pip uninstall statistics`. Then, ensure your Python environment is 3.8 or newer and try again; `fmean` will be available from the built-in module.
ModuleNotFoundError: No module named 'statistics'
You are likely running Python 2.x or an older Python 3 version (prior to 3.4) and have not installed the PyPI `statistics` package.
fix
For Python 2.x or Python < 3.4, install the PyPI package: `pip install statistics`. For Python 3.4+, this error should not occur, as `statistics` is built-in; verify your Python version and environment.
TypeError: ('median_grouped() takes at most 2 arguments (3 given)',)
This error occurs in older versions of `statistics.median_grouped` (like the Python 3.4 implementation in the PyPI backport) when attempting to pass the `interval` argument, which was introduced in Python 3.8. It indicates you're using an older version of the `statistics` module.
fix
If on Python 3.8+, uninstall the PyPI `statistics` package (`pip uninstall statistics`) to ensure you're using the built-in, more recent version. If on an older Python version, you may need to manually calculate or upgrade your Python version to access newer features.
Upgrade
Version history
1.0.3.5latest on PyPI · released Oct 16, 2014
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
12
OpenAI (training)
1
Resources
homepageUNKNOWN
statistics — pip install statistics · libregistry