tl;dr – balance v0.12.0
We're excited to announce balance v0.12.0! Since our initial release, balance has evolved into a comprehensive Python package for adjusting biased samples. This post highlights the most significant improvements from v0.1.0 (2022-11-20) through v0.12.0 (2025-10-14), showcasing how we've made balance easier to use:
- Expanded compatibility: Now supports Python 3.9–3.14 on Windows, macOS, and Linux, with smarter dependency management and a switch to the MIT license.
- Major upgrades: Improved statistical methods (IPW, raking, poststratification), interactive Plotly visualizations, and new variance/confidence interval tools.
- Better experience: Enhanced CLI, bug fixes, and expanded docs/tutorials for easier use and learning.
Cutting-Edge Python Compatibility
balance now supports all three major OS platforms: Windows, macOS, and Linux - for Python 3.9 through 3.14, ensuring you can use the latest Python features without compatibility concerns.
What's New:
- Full support for Windows
- Full support for Python 3.11, 3.12, 3.13 and 3.14
- Smart dependency management with version-specific constraints for
numpy,pandas,scipy, andscikit-learnfor Python 3.9-3.11. - Greater flexibility for Python 3.12+ users with removed upper version constraints, while eliminating 260+ pandas deprecation warnings and modernized our code.
- Python 3.8 deprecated due to typing incompatibilities
- License Update from GPL v2 to the MIT license for greater flexibility and easier integration into your projects
Methodological Improvements
Transition to scikit-learn for IPW
We've migrated from glmnet to scikit-learn's logistic regression (v0.10.0) for our inverse propensity weighting (IPW) method, bringing significant benefits:
Pros:
- Windows OS support
- Python 3.11+ compatibility
- Eliminated
glmnetdependency
Trade-offs:
- Uses L2 penalties instead of L1 (slight weight differences)
- 2-5x slower than previous version
Raking Algorithm: Faster and More Reliable
We've completely refactored our raking (rake weighting) implementation with an array-based IPFN algorithm that delivers:
- Support for marginal distribution target distributions with the new
prepare_marginal_dist_for_rakinghelper function - Better performance across all Python versions
- Consistent results through automatic variable alphabetization
Flexibility with Poststratification
The poststratify method now includes a strict_matching parameter (default True). When set to False, it gracefully handles missing sample cells by issuing warnings and assigning zero weights.
Visualization and Summarization Enhancements
Interactive Plotting
All visualization functions now produce interactive Plotly plots by default:
- Customizable layouts via
kwargs(control width, height, and more) - New
plotly_plot_densityfor interactive kernel density estimation with support for 'kde' plots inplotly_plot_distandplot_dist BalanceWeightsDF.plotnow uses Plotly instead of static seaborn plots

All bar plots now support ylim argument for precise y-axis control:
s3_null.covars().plot(ylim=(0, 1))
Statistical Summaries
New variance and confidence interval methods make it easier to assess uncertainty:
.var_of_mean()- Variance of weighted means.ci_of_mean()- Confidence intervals for weighted means.mean_with_ci()- Combined mean with confidence intervals- Enhanced
.summary()method forBalanceWeightsDF
Developer Experience
Notable Bug Fixes
- Fixed
rm_mutual_nasto preserve Series index - Improved
Sample.from_frameweight column detection (now recognizes "weights" and "weight") - Better handling of int8/int16 columns (converts to float16)
- Fixed color assignments in comparison plots
- Resolved various edge cases in
plot_hist_kdeandplot_bar
CLI Improvements
The command-line interface now offers more control:
- Formula specification via string arguments
- Type standardization controls
- Original dtype preservation with
--return_df_with_original_dtypes - Flexible trimming with
weight_trimming_mean_ratio=Noneoption - Enhanced logging with dtype change warnings
Documentation & Tutorials
We've significantly expanded our documentation with new tutorials:
- Quickstart - Get started with balance basics
- Quickstart with Raking - Compare raking vs. IPW
- Quickstart with CBPS - Covariate Balancing Propensity Score method
- Transformations and Formulas - Advanced covariate preprocessing
- CBPS: R vs. Python Comparison - Validation against R's CBPS package
Also added a Link to conference presentations (ISA 2023).
This extends our existing Statistical Methods Documentation:
- Inverse Propensity Weighting (IPW)
- Covariate Balancing Propensity Score (CBPS)
- Post-stratification
- Raking
Community & Contributors
A huge thank you to our contributors: @talgalili, @wesleytlee, @SarigT, @ahakso, @stevemandala, @tomwagstaff-opml, @zbraiterman, and @luca-martial!
Want to contribute? Check out our contributing guide.
Get Started Today
Ready to try balance or upgrade to v0.12.0?
Installation:
python -m pip install balance
Resources:
- Website: https://import-balance.org/
- GitHub: https://github.com/facebookresearch/balance
- Documentation: https://import-balance.org/docs/docs/general_framework/
- Tutorials: https://import-balance.org/docs/tutorials/
- Blog: https://import-balance.org/blog/
- Paper: balance – a Python package for balancing biased data samples (Sarig, Galili, & Eilat, 2023)
Get Help:
- Ask questions: https://github.com/facebookresearch/balance/issues/new?template=support_question.md
- Report bugs: https://github.com/facebookresearch/balance/issues/new?template=bug_report.md
- Request features: https://github.com/facebookresearch/balance/issues/new?template=feature_request.md
We welcome your feedback, questions, and contributions as we continue making balance the go-to tool for survey statistics and bias adjustment in Python!
