phik
Phi_K correlation analyzer library
What it is and what it does
Phi_K is a correlation coefficient designed to handle mixed data types—categorical, ordinal, and interval variables—in a single analysis. Unlike traditional correlation methods that require homogeneous data types, Phi_K applies a refinement of Pearson's hypothesis test of independence, interpreting the contingency test statistic as if from a rotated bivariate normal distribution. It captures non-linear relationships and reverts to standard Pearson correlation when the input is bivariate normal, making it useful for exploratory data analysis on heterogeneous datasets.
The package integrates with pandas DataFrames through methods like `phik_matrix()`, `significance_matrix()`, and `global_phik()`, and includes utilities for generating correlation reports as PDFs. It depends on numpy, scipy, pandas, matplotlib, and joblib, and is available as pre-built wheels for Python 3.9–3.14 across macOS, Linux, and Windows. The methodology is grounded in a peer-reviewed publication and includes example notebooks for basic and advanced usage.
Use it for:
- Compute correlation matrices for datasets mixing categorical survey responses, ordinal ratings, and continuous measurements.
- Detect non-linear dependencies between variables that Pearson correlation would miss.
- Generate statistical significance tests for variable-pair dependencies in contingency tables.
- Create correlation reports with visualizations for exploratory data analysis on mixed-type datasets.
- Identify outliers and unusual patterns via normalized residuals of contingency tests.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Phi_K computes a correlation coefficient that works consistently across categorical, ordinal, and interval variables, capturing non-linear dependencies while reverting to Pearson correlation for bivariate normal data.
Yes, if you work with mixed-type data and need a single correlation method that handles categorical, ordinal, and interval variables together. The permissive MIT license and broad Python version support make adoption low-risk. However, the aging maintenance status (no release in 393 days) suggests checking whether active development continues before relying on it for production systems. No known vulnerabilities.
Install
phik on PyPI
pip
pip install phikuv
uv add phikpoetry
poetry add phikInstalling phik
Before you install
Medium install friction due to compiled wheels for multiple Python versions (3.10–3.14) and platforms, but pre-built binaries are available. Package is aging (393 days since last release in July 2025) with no recent maintenance signal.
License in practice
MIT license (permissive) permits commercial and private use with minimal restrictions, making it suitable for most projects.
Quickstart
pip install phik
import pandas as pd
import phik
df = pd.read_csv('data.csv')
phik_matrix = df.phik_matrix()
significance = df.significance_matrix()
Requires Python >= 3.9; depends on numpy, scipy, pandas, matplotlib, and joblib.
Verify before relying
- Whether the package is actively maintained or if aging status indicates stalled development.
- Performance characteristics when applied to large datasets or high-dimensional correlation matrices.
- Specific use cases where Phi_K outperforms alternatives for mixed-type data beyond the published paper.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 5 — numpy, scipy, pandas, matplotlib, joblib |
| Maintenance | aging — 393 days since the last release |
| First released | |
| Downloads | 1,210,795/month — #4,213 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: phik-0.12.5-cp310-cp310-macosx_10_13_x86_64.whl; phik-0.12.5-cp310-cp310-macosx_11_0_arm64.whl; phik-0.12.5-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; phik-0.12.5-cp310-cp310-win_amd64.whl; phik-0.12.5-cp311-cp311-macosx_10_13_x86_64.whl; phik-0.12.5-cp311-cp311-macosx_11_0_arm64.whl; phik-0.12.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; phik-0.12.5-cp311-cp311-win_amd64.whl; phik-0.12.5-cp312-cp312-macosx_10_13_x86_64.whl; phik-0.12.5-cp312-cp312-macosx_11_0_arm64.whl; phik-0.12.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; phik-0.12.5-cp312-cp312-win_amd64.whl; phik-0.12.5-cp313-cp313-macosx_10_13_x86_64.whl; phik-0.12.5-cp313-cp313-macosx_11_0_arm64.whl; phik-0.12.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; phik-0.12.5-cp313-cp313-win_amd64.whl; phik-0.12.5-cp314-cp314-macosx_10_13_x86_64.whl; phik-0.12.5-cp314-cp314-macosx_11_0_arm64.whl; phik-0.12.5-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; phik-0.12.5-cp314-cp314-win_amd64.whl
Tags
More Information Analysis packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyarrowpyarrow provides Python bindings to Apache…
permissive · top 100 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
snowflake-snowpark-pythonSnowpark Python provides APIs to query and…
permissive · top 1,000 on PyPI
hyppohyppo provides multivariate hypothesis testing…
permissive · top 15,000 on PyPI
category-encodersTransforms categorical variables into numeric…
permissive · top 5,000 on PyPI
pingouinPingouin provides a comprehensive statistical…
copyleft · top 15,000 on PyPI
kmodesImplements k-modes and k-prototypes clustering…
permissive · top 15,000 on PyPI
scikit-surpriseScikit-surprise builds and evaluates…
permissive · top 15,000 on PyPI
tabmatProvides efficient matrix classes for tabular…
unclear · top 15,000 on PyPI
ipfnIterative proportional fitting algorithm that…
permissive · top 15,000 on PyPI
catboostCatBoost is a gradient boosting library that…
permissive · top 5,000 on PyPI