skillfed

phik

Phi_K correlation analyzer library

phik v0.12.5 1.2M downloads/30d#4,213 on PyPI
Permissive license AGING released

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 phik

uv

uv add phik

poetry

poetry add phik

Installing 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

Development Status :: 4 - BetaLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9

Tags

correlation coefficient mixed data typescategorical ordinal interval correlationphi_k correlation analyzernon-linear dependency detectionmixed variable correlation matrixcontingency table correlationstatistical correlation analysis
correlation-analysismixed-data-typesstatistical-testing

More Information Analysis packages