A logger wrapper for OpenDP to keep track of, import, export the AST
Project description
OpenDP Logger
The OpenDP logger makes it possible to serialize and deserialize OpenDP Measurements/Transformations to/from JSON.
Serialize
Enable logging (globally) before you build your transformations and/or measurements:
from opendp_logging import enable_logging
enable_logging()
Once this is enabled, Transformations/Measurements have a method .to_json()
that returns a JSON string.
Deserialize
Deserialize a JSON string into a Transformation/Measurement by invoking opendp_logger.make_load_json
.
Example
from opendp_logger import enable_logging
from opendp.mod import enable_features
enable_logging()
enable_features("contrib")
import opendp.transformations as trans
preprocessor = (
# load data into a dataframe where columns are of type Vec<str>
trans.make_split_dataframe(separator=",", col_names=["hello", "world"])
>>
# select a column of the dataframe
trans.make_select_column(key="income", TOA=str)
)
# serialize the chain to json
json_obj = preprocessor.to_json()
print("json:", json_obj)
from opendp_logger import make_load_json
# reconstruct the obj from the json string
test = make_load_json(json_obj)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file opendp_logger-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: opendp_logger-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74093321625d40d3731943711be8874e0b931c7bc4de20c884887ab83e69512d |
|
MD5 | 23e280075df5331d4ac0419462e559f6 |
|
BLAKE2b-256 | 1193db547e79737694a4f2aedf1212c924b23578ad056733ed4f603f84a38b4d |