pyratemaking 📊
Pure-Python ratemaking for P&C insurance — end to end.
pyratemaking is the Python implementation of the Werner & Modlin ratemaking workflow: rate level indication, on-leveling, trending, development, classification analysis, large loss procedures, and rate implementation. Built for P&C actuaries who want a reproducible pipeline from raw policies and claims to a defensible rate filing.
Why
Python has GLM libraries. It has chain-ladder libraries. It does not have an end-to-end ratemaking workflow. pyratemaking is that workflow.
Install
pip install pyratemaking # core
pip install pyratemaking[full] # with full ecosystem (whsmooth, actudist, etc.)
Quickstart
from pyratemaking import RatePlan
from pyratemaking.datasets import french_motor
policies, claims = french_motor.load()
plan = RatePlan(
policies=policies,
claims=claims,
exposure_col="exposure",
loss_col="claim_amount",
ay_col="policy_ay",
)
indication = plan.indicate(method="loss_ratio", target_lr=0.65)
print(indication.summary())
plan.classify(
rating_vars=["driver_age", "veh_power", "region"],
backend="glum",
family="tweedie",
power=1.5,
)
plan.implement(cap=1.15, floor=0.85)
plan.report.filing("filing_2026.html")
Werner & Modlin coverage
| Chapter | Topic | Module |
|---|---|---|
| 5 | On-leveling | pyratemaking.onleveling |
| 6 | Loss development | pyratemaking.development |
| 7 | Trending | pyratemaking.trending |
| 8 | Overall rate level indication | pyratemaking.core.indication |
| 9-10 | Classification ratemaking | pyratemaking.core.classification |
| 11 | Increased limits / large loss | pyratemaking.large_loss |
| 12 | GLMs | pyratemaking.glm |
| 14 | Implementation | pyratemaking.core.implementation |
Ecosystem
Part of a 6-library actuarial Python suite:
actudist— severity and frequency distributionsburncost— burning cost analysisactuarcredibility— credibility methodswhsmooth— Whittaker-Henderson smoothingpyratemaking— ratemaking workflow (this library)pyinsurancerating— rating engine (coming)
Roadmap
Future releases will add Bayesian hierarchical credibility, deep-learning rating models (LocalGLMnet, CANN), premium calculation principles, fairness auditing, a CLI tool, and a Streamlit exploration dashboard. See milestones.
References
- Werner, G. & Modlin, C. (2016). Basic Ratemaking (5th ed.). Casualty Actuarial Society.
- Goldburd, M., Khare, A., Tevet, D. & Guller, D. (2020). Generalized Linear Models for Insurance Rating (2nd ed.). CAS Monograph 5.
- Friedland, J. (2013). Fundamentals of General Insurance Actuarial Analysis. Society of Actuaries.
- Mack, T. (1993). "Distribution-free Calculation of the Standard Error of Chain Ladder Reserve Estimates." ASTIN Bulletin, 23(2), 213-225.
License
MIT © Isaac López
Metadata
Release files for pyratemaking 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyratemaking-0.1.1.tar.gz | 72.3 kB | Without provenance | Details for pyratemaking-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyratemaking-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pyratemaking-0.1.1-py3-none-any.whl |
Total release size: 149.9 kB
Release files / pyratemaking-0.1.1.tar.gz
| Download URL | pyratemaking-0.1.1.tar.gz |
|---|---|
| Size | 72.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e06dca49716abb39c38398f5bda96e83634c23fdcfa2a0e92e076c0dc1f4520
|
|
BLAKE2b-256 checksum How to use checksums |
3af426919ec50724b8c763a91081fe3b1f6e166badae09db7a237092f722af6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / pyratemaking-0.1.1-py3-none-any.whl
| Download URL | pyratemaking-0.1.1-py3-none-any.whl |
|---|---|
| Size | 77.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67a62b1e7de6d8ce7eda28c3dc2a661607e746d61970d208968adabc15c0bdab
|
|
BLAKE2b-256 checksum How to use checksums |
7078d04661bc7bd20339442c3020982171db29c8b4a08dce183dcc325cc7dd61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for pyratemaking 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.