Skip to main content

pkpdutils: pharmacokinetic and pharmacodynamic analysis

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

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

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.

Metadata

Release files for pkpdutils 1.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pkpdutils 1.7.1
File Size Uploaded Provenance Actions
pkpdutils-1.7.1.tar.gz 3.0 MB With provenance Details for pkpdutils-1.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pkpdutils 1.7.1
File Interpreter ABI Platform Actions
pkpdutils-1.7.1-py3-none-any.whl Python 3 none any Details for pkpdutils-1.7.1-py3-none-any.whl

Total release size: 3.4 MB

Release files / pkpdutils-1.7.1.tar.gz

Download URL pkpdutils-1.7.1.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
bda64242a4f0e8a97b3cffe4fc9d4a8acc04dfec5ed0216be8ecfefd7c0ac973
BLAKE2b-256 checksum
How to use checksums
d0ece032900b90a41860dca6a14240538faeb67e53b12fd71df8c375ee14df68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / pkpdutils-1.7.1-py3-none-any.whl

Download URL pkpdutils-1.7.1-py3-none-any.whl
Size 398.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3db3407a6e7e87470467ffe798eacb0a49683b901a7952ee19c0a6cb9f11f24
BLAKE2b-256 checksum
How to use checksums
4a019bccbcea854c7918562d1505b82c956ed36d988b3cd297c2ffd6739ab4f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Security for pkpdutils 1.7.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pkpdutils-1.7.1.tar.gz

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 Nov 24, 2026.

Transparency log

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.

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