fast-krippendorff

raw JSON →
0.8.2 verified Mon Apr 27 auth: no python

Fast computation of Krippendorff's alpha inter-rater reliability measure. Version 0.8.2 supports Python 3.10+. Released irregularly, with recent updates for NumPy v2 compatibility and Python version bumps.

pip install krippendorff
error ModuleNotFoundError: No module named 'krippendorff'
cause Package not installed or installed under a different name (e.g., 'fast-krippendorff').
fix
Run: pip install krippendorff
error ValueError: A single coder was provided (or all units have less than 2 coders).
cause Reliability data matrix has only one non-NaN entry per unit, or only one coder overall.
fix
Provide data from at least two coders; ensure each unit has annotations from at least two coders.
error TypeError: 'numpy.float64' object is not iterable
cause Calling alpha on a 1D array instead of 2D (coders x units).
fix
Ensure the input is a 2D numpy array with shape (n_coders, n_units).
breaking Python 3.9 support dropped in v0.8.2; requires Python >=3.10.
fix Upgrade Python to 3.10 or later.
breaking NumPy v1 compatibility removed in v0.8.1; requires NumPy v2 or later.
fix Upgrade NumPy to >=2.0.
gotcha If all units have fewer than 2 coders assigned, alpha raises a ValueError. Ensure your reliability data matrix has at least two coders per unit.
fix Check that each column (unit) has at least two non-NaN entries.
gotcha String dtype for reliability_data might cause unexpected behavior with missing values (NaNs) in older versions (<0.5.1). Fixed in 0.5.1.
fix Upgrade to 0.5.1+ or use numeric dtypes.

Compute Krippendorff's alpha for nominal data with missing values.

import numpy as np
from krippendorff import alpha

# Reliability data: 3 coders, 4 units, with a missing value (np.nan)
reliability_data = np.array([
    [1, 2, 3, np.nan],
    [1, 2, 3, 4],
    [2, 2, 3, 4]
])

result = alpha(reliability_data, level_of_measurement='nominal')
print(f"Krippendorff's alpha: {result}")