Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Measurement
✓ from opendp.typing import Measurement
✗ from opendp import Measurement
Measurement is in opendp.typing
then_count
✓ from opendp.transformations import then_count
✗ from opendp import then_count
Transformations are in opendp.transformations
base_laplace
✓ from opendp.measurements import base_laplace
✗ from opendp import base_laplace
Measurements are in opendp.measurements
Simple differential privacy count query using OpenDP's compositor and transformation chain.
import opendp
from opendp.transformations import make_split_dataframe, make_select_column, then_count, then_clamp, then_resize, then_variance, then_mean
from opendp.measurements import then_laplace, then_gaussian
from opendp.domains import vector_domain, atom_domain
from opendp.metrics import symmetric_distance
from opendp.typing import L2Sensitivity
context = opendp.Context.compositor(
data=... , # your data
privacy_unit=opendp.parameters.unit('epsilon=1, delta=0.01')
)
# Example: count with Laplace noise
meas = (opendp.preprocessing.make_split_dataframe(",", ["A", "B"])) >> \
(opendp.transformations.make_select_column("A", TOA=str)) >> \
(then_count()) >> \
(then_laplace(scale=1.0))
released = meas(meas.arg)
print(released)
Errors
Common errors & fixes
AttributeError: module 'opendp' has no attribute 'transformations'
Older import pattern; opendp submodules are not directly exposed.
fixUse `from opendp.transformations import ...` instead of `opendp.transformations.make_count`.
TypeError: base_laplace() missing 1 required positional argument: 'scale'
Base measurements require scale as an argument; old code might have used default.
fixAlways provide scale: `base_laplace(scale=1.0)`.
NotImplementedError: This operation is not supported.
Using a transformation or measurement before preparing context or chaining correctly.
fixEnsure the chain consists of transformations ending with a measurement; use `>>` operator.
ImportError: cannot import name 'make_count' from 'opendp.transformations'
`make_count` was removed or renamed to `then_count`.
fixUse `from opendp.transformations import then_count`.
Upgrade
Version history
0.15.1latest on PyPI · released May 29, 2026
Audit
Dependencies
No dependency data recorded yet.