pkpdutils: pharmacokinetic and pharmacodynamic analysis
pkpdutils is a python library for the pharmacokinetic (PK) and pharmacodynamic (PD) analysis of timecourses and parameters. It was formerly published as pkdb-analysis, the analysis toolbox of PK-DB; version 1.0.0 is a rewrite without any PK-DB dependency.
Features include
- non-compartmental analysis - exposure, peak, terminal phase, clearance and volume parameters of concentration and effect timecourses, single dose and multiple dosing (every dosing interval, steady state, accumulation), with units
- data formats - read event records (NONMEM, Monolix), the two PKNCA tables and the CDISC ADaM ADNCA dataset, write event records back
- uncertainty - bootstrap and delta method propagation for group timecourses (mean ± SD), summary statistics over individuals
- curve fitting - exponential, Bateman, Emax, dose proportionality and covariate models with standard errors, confidence intervals and model comparison
- statistics on parameters - significance tests, geometric mean ratios, bioequivalence, classification of drug–drug interactions, meta-analysis
- figures - timecourses, NCA diagnostics, fits, parameter distributions, forest and ratio plots
All data structures are xarray datasets with pint units, so many timecourses are analysed in one vectorized call.
The documentation is available at https://matthiaskoenig.github.io/pkpdutils.
If you have any questions or issues please open an issue.
Quickstart
A study of twelve subjects in three dose groups, from the event table it arrives in to the parameter table and the figure of the report. The table is study.csv, which the first walk-through of the Workflows builds:
import pandas as pd
from pkpdutils import Route, Timecourses, nca, summary_table
from pkpdutils.console import print_table
from pkpdutils.plot import plot_mean_timecourse
# [study.csv](https://raw.githubusercontent.com/matthiaskoenig/pkpdutils/develop/docs/data/study.csv):
# ID, TIME, DV, AMT, EVID and the dose group
events = pd.read_csv("study.csv")
batch = Timecourses.from_events(
events,
time_unit="hr",
unit="mg/l",
dose_unit="mg",
route=Route.ORAL,
covariates=["dose"],
)
result = nca(batch)
table = summary_table(
result,
"individual",
by="dose",
parameters=["auc_inf_obs", "cmax", "thalf", "cl_f"],
stats=("n", "geomean", "geocv", "median", "range"),
unit_style="short",
)
print_table(table, title="Pharmacokinetic parameters by dose group")
plot_mean_timecourse(batch, by="dose").savefig("study_curves.png", dpi=120)
The table the snippet prints, the geometric mean with its coefficient of variation per dose group:
Pharmacokinetic parameters by dose group
parameter unit dose n geomean geocv median range
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
auc_inf_obs h⋅mg/l 50 4 5.07 28.0 % 4.76 4.08 - 7.29
cmax mg/l 50 4 0.925 14.9 % 0.883 0.818 - 1.15
thalf h 50 4 2.86 23.5 % 2.72 2.37 - 3.89
cl_f l/h 50 4 9.86 28.0 % 10.7 6.86 - 12.3
auc_inf_obs h⋅mg/l 100 4 10.2 27.1 % 9.58 8.22 - 14.4
cmax mg/l 100 4 1.87 10.6 % 1.79 1.75 - 2.19
thalf h 100 4 2.87 24.2 % 2.73 2.35 - 3.91
cl_f l/h 100 4 9.84 27.1 % 10.6 6.94 - 12.2
auc_inf_obs h⋅mg/l 200 4 20.4 26.0 % 19.3 16.6 - 28.6
cmax mg/l 200 4 3.69 6.82 % 3.70 3.38 - 3.99
thalf h 200 4 2.89 25.9 % 2.75 2.33 - 4.05
cl_f l/h 200 4 9.79 26.0 % 10.5 6.98 - 12.0
The same steps with the table built in place, the parameters printed and four more walk-throughs (bioequivalence, drug-drug interaction, steady state, dose proportionality) are in the Workflows of the documentation; the Gallery shows a figure and a snippet for every example of the repository.
How to cite
If you use pkpdutils please cite the archived software on Zenodo:
König, M. (2026). pkpdutils: pharmacokinetic and pharmacodynamic analysis of timecourses and parameters (Version 1.2.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.22808373
Installation
pkpdutils requires python >= 3.13 and is available from pypi:
uv add pkpdutils
or with pip
pip install pkpdutils
See Installation for details and Development for working on the repository.
License
- Source Code: MIT
- Documentation: CC BY-SA 4.0
Funding
Matthias König is supported by the German Research Foundation (DFG) within the Research Unit Programme FOR 5151 "QuaLiPerF (Quantifying Liver Perfusion-Function Relationship in Complex Resection - A Systems Medicine Approach)" by grant number 436883643 and by grant number 465194077 (Priority Programme SPP 2311, Subproject SimLivA).
Matthias König was supported by the Federal Ministry of Education and Research (BMBF, Germany) within the research network Systems Medicine of the Liver (LiSyM, grant number 031L0054).
© 2018-2026 Matthias König.
Release files for pkpdutils 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pkpdutils-1.3.0.tar.gz | 3.0 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pkpdutils-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.4 MB
Release files / pkpdutils-1.3.0.tar.gz
| Download URL | pkpdutils-1.3.0.tar.gz |
|---|---|
| Size | 3.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa3897d753eda8fb79ffb010412a99e3834c52c2a7ae66f4dc31d21ed38f8096
|
|
BLAKE2b-256 checksum How to use checksums |
74f4f3c34f695676cc945feec731b0ecd11c57aa1703f3c6259445b75af92236
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / pkpdutils-1.3.0-py3-none-any.whl
| Download URL | pkpdutils-1.3.0-py3-none-any.whl |
|---|---|
| Size | 353.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19e532f9c72a06322b6d3d729f7d8f17f375e5aa74c51a2ebd819e918a79bcb1
|
|
BLAKE2b-256 checksum How to use checksums |
97cc0e448e0ad0567b042b2d6dafe2259403b3cdc1b83301079f175344e72d23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log