$ show raphaelvallat/pingouin
Pingouin is a mature Python library for statistical analysis, providing a comprehensive suite of parametric and non-parametric hypothesis tests, effect sizes, power analysis, Bayes factors, and data visualization. Unlike lower-level libraries like SciPy and statsmodels, Pingouin returns rich, ready-to-interpret DataFrames with all relevant statistics (p-values, confidence intervals, effect sizes, Bayes factors, power) in a single call. The library is designed for researchers and data analysts in the social, biomedical, and behavioral sciences, and its API is tightly integrated with pandas via method chaining (e.g., `df.anova()`, `df.pairwise_corr()`). The codebase is modular, with each module dedicated to a class of statistical methods (parametric, nonparametric, correlation, regression, etc.), and includes bundled example datasets and extensive documentation. Its architecture follows a functional pattern built on top of NumPy, SciPy, pandas, and statsmodels, with optional dependencies for plotting and machine learning. The library is actively maintained, with a recent release (v0.6.1) and CI/CD pipelines ensuring compatibility with Python 3.10–3.14 and the latest versions of its scientific stack.
The LLM identified 3 files worth highlighting for reuse:
Implements a collection of multiple comparison correction methods (Bonferroni, Holm, Sidak, FDR Benjamini-Hochberg, FDR Benjamini-Yekutieli) as a standalone function. The module is self-contained, relying only on NumPy and SciPy, and can be extracted and reused in any project requiring p-value adjustment. It demonstrates careful handling of edge cases (e.g., negative p-values, NaN propagation) and follows the standard statistical definitions.
A collection of core utility functions used across the entire library: `remove_na` for listwise deletion of missing values from multiple arrays, `_check_dataframe` for input validation, `_postprocess_dataframe` for consistent output formatting (rounding, column naming), and helper functions for permutation p-values and dependency version checks. These functions are self-contained (only external dependencies: NumPy, pandas, SciPy) and can be reused in any data analysis pipeline. The `_postprocess_dataframe` pattern, which applies global formatting options via a config, is particularly elegant.
A minimal and clean module implementing a global options dictionary for the library. It provides a thread-safe way to set formatting preferences (e.g., rounding precision) that propagate to all output functions. This small module demonstrates a reusable pattern for managing user-configurable settings in a library, avoiding the need for per-function parameters. It can be extracted and adapted for any project needing a simple, global configuration system.