ipfn
Iterative Proportional Fitting with N dimensions, for python
Decision gist · record as of 2026-08-14
Yes, if you need iterative proportional fitting and can tolerate dormancy. The package is stable and low-friction to install, with no known vulnerabilities and a permissive MIT license. However, expect no active maintenance—last release was 2021-12-30. Use it for well-understood IPF problems; do not expect bug fixes or updates if you encounter edge cases.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction install with only pandas and numpy as runtime dependencies.
- Package is dormant—last release was 2021-12-30 and last commit 2024-05-10, so expect no active maintenance or bug fixes.
License · maintenance · safety
MIT (permissive) — MIT license is permissive, allowing commercial and private use with minimal restrictions; you may use and modify freely provided you retain the license notice.
last release 2021-12-30 (1688 days) · last repo commit 2024-05-10 · 106 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 102,246 downloads/mo, #12,881 on PyPI
Alternatives
Verify before relying
import numpy as np
from ipfn import ipfn
m = np.array([[40, 30, 20, 10], [35, 50, 100, 75], [30, 80, 70, 120], [20, 30, 40, 50]])
xip = np.array([150, 300, 400, 150])
xpj = np.array([200, 300, 400, 100])
IPF = ipfn.ipfn(m, [xip, xpj], [[0], [1]], convergence_rate=1e-6)
m_fitted = IPF.iteration()
print(m_fitted)- Whether the algorithm converges reliably on all input types and dimensions, or if certain edge cases are known to fail.
- Performance characteristics on large multidimensional arrays relative to the R ipfp package it claims equivalence with.
- Whether dormancy means the package is stable-complete or abandoned and no longer maintained.
What it is and what it does
ipfn implements the iterative proportional fitting algorithm, a mathematical technique used in economics, demography, and social sciences to adjust a multidimensional contingency table so that its marginal sums (aggregates along one or more dimensions) match known target values. The package automatically selects between a fast numpy implementation and a slower but more user-friendly pandas implementation based on input type.
You provide an original array or dataframe, a list of target marginals, and the dimensions along which each marginal should apply. The algorithm iteratively rescales the table until convergence. It exposes control over iteration limits, convergence tolerance, and verbosity, returning either the fitted result, a success flag, or detailed iteration diagnostics depending on the verbosity level.
Use it for
- Adjust population survey data to match known demographic totals across multiple geographic and age categories.
- Rescale economic input-output tables to match independently estimated row and column sums.
- Balance contingency tables in social science research when marginal distributions are known but cell values are uncertain.
- Calibrate multidimensional traffic or flow models to match observed aggregate counts on subsets of dimensions.
- Prepare synthetic microdata by adjusting initial samples to match target distributions on multiple cross-tabulated variables.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need iterative proportional fitting and can tolerate dormancy.
The package is stable and low-friction to install, with no known vulnerabilities and a permissive MIT license. However, expect no active maintenance—last release was 2021-12-30. Use it for well-understood IPF problems; do not expect bug fixes or updates if you encounter edge cases.
Install
ipfn on PyPI
Before you install
Low friction install with only pandas and numpy as runtime dependencies. Package is dormant—last release was 2021-12-30 and last commit 2024-05-10, so expect no active maintenance or bug fixes.
License in practice
MIT license is permissive, allowing commercial and private use with minimal restrictions; you may use and modify freely provided you retain the license notice.
Quickstart
import numpy as np
from ipfn import ipfn
m = np.array([[40, 30, 20, 10], [35, 50, 100, 75], [30, 80, 70, 120], [20, 30, 40, 50]])
xip = np.array([150, 300, 400, 150])
xpj = np.array([200, 300, 400, 100])
IPF = ipfn.ipfn(m, [xip, xpj], [[0], [1]], convergence_rate=1e-6)
m_fitted = IPF.iteration()
print(m_fitted)
Verify before relying
- Whether the algorithm converges reliably on all input types and dimensions, or if certain edge cases are known to fail.
- Performance characteristics on large multidimensional arrays relative to the R ipfp package it claims equivalence with.
- Whether dormancy means the package is stable-complete or abandoned and no longer maintained.
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespandasnumpy |
| Maintenance | Dormant 1,688 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 102,246 / month, #12,881 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Topic :: Software Development :: Build Tools |
Evidence: ipfn-1.4.4-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “iterative proportional fitting”
- ipfnIterative proportional fitting algorithm that adjusts…
- piecewise-regressionFits piecewise linear regression models to data with one or more…
- iterative-telemetrySends anonymized telemetry data from Iterative tools, collecting…
Give your agent the search over MCP, or paste the wish link into any chat.
More Build Tools packages
Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.
Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.
Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.
pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.
Install it if your team needs consistent, automated validation at commit time.
See also awkward-pandas · numpy-groupies · swifter · itables · Pint-Pandas · nptyping · sklearn-pandas · pandas-read-xml · piecewise-rational · datacompy