Skip to main content


Welcome to OpenDP, a powerful library for privacy-preserving data analysis. OpenDP provides a wide range of functions and methods to ensure the privacy of sensitive data while still enabling a meaningful analysis. This page will guide you on how to get started with op_opendp and make the most of its features.

For detailed information about OpenDP's function signatures and methods, refer to the official OpenDP documentation. The documentation provides comprehensive guidance on how to use each feature of the library effectively.

Import the library as follows:

import op_opendp

Currently, we support all the functionality of OpenDP in the op_opendp package with same module names and function signatures.

Creating Pipelines

Opendp offers numerous measurements and transformations that can be utilised to construct differentially private pipelines, providing a wide range of options. For instance, one example of calculating the count of number of elements can be as follows:

from op_opendp.transformations import make_count
from op_opendp.measurements import make_base_discrete_laplace

pipeline_1 = make_count(TIA=float) # Non differentially private unit of measurement
eps = 0.5
pipeline_2 = (make_count(TIA=float) >> make_base_discrete_laplace(1./eps)) # Differentially private unit of measurement

Executing the Pipelines

Op_opendp includes several measures to ensure that only differentially private pipelines are executed, thereby preventing the execution of non-differentially private pipelines like pipeline_1 mentioned earlier. Therefore, in order to run the pipelines, they must be processed through the run_pipeline method provided by op_opendp.

op_opendp.run_pipeline(pipeline: op_opendp.Measurement, data: PrivateSeries | PrivateDataFrame | List, d_in: Any)
  • pipeline: a differentially private pipeline (it should be of the type op_opendp.Measurement)
  • data: data to run the pipeline on
  • d_in: distance in terms of the input metric (used to calculate epsilon and make privacy request)