Skip to main content

pkpdutils: pharmacokinetic and pharmacodynamic analysis

GitHub Actions CI/CD Status Documentation Version Python Versions MIT License DOI

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 mean curve of every dose group with its standard deviation, linear and semi-logarithmic

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

DOI

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.1.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.22792388

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

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pkpdutils-1.2.0.tar.gz (2.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pkpdutils-1.2.0-py3-none-any.whl (345.3 kB view details)

Uploaded Python 3

File details

Details for the file pkpdutils-1.2.0.tar.gz.

File metadata

  • Download URL: pkpdutils-1.2.0.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pkpdutils-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e943525e17be14772129f1dc2bbdf9186b3a3d7a609018ac34cda0a61a463ea7
MD5 2a45dd20748a859deb00fe8ab0ec6786
BLAKE2b-256 cb7d35ba4bb68f1ce3b1146dadbdb369c58fc93170367d0150f20d8d07b2f0d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pkpdutils-1.2.0.tar.gz:

Publisher: ci-cd.yml on matthiaskoenig/pkpdutils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pkpdutils-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pkpdutils-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 345.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pkpdutils-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af7386d4b5f6fc18ee25a7d8b4542e6e8c7f553653921d9a2b22990229bc55f1
MD5 f9ebb52e091dc10b6f81a0df298a1ac7
BLAKE2b-256 3865e9f00b75ae3cb2f58519c95bfcb053997c62273ec02bc41143c04b5a6e61

See more details on using hashes here.

Provenance

The following attestation bundles were made for pkpdutils-1.2.0-py3-none-any.whl:

Publisher: ci-cd.yml on matthiaskoenig/pkpdutils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 files

1.1.0

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page