Presidio结构化包 - 分析和匿名化结构化和半结构化数据。
项目描述
Presidio结构化
状态
Alpha:此包目前处于alpha阶段,意味着它处于开发的早期阶段。功能和功能可能会随着项目的发展而变化。
描述
Presidio结构化包是一个灵活且可定制的框架,旨在识别和保护结构化敏感数据。该工具扩展了Presidio的功能,专注于结构化数据格式,如表格格式和半结构化格式(JSON)。它利用Presidio-Analyzer的检测功能来识别包含个人身份信息(PII)的列或键,并在这这些列/键名称和检测到的PII实体之间建立映射。检测完成后,使用Presidio-Anonymizer对被识别为包含PII的列中的每个值应用去标识技术,确保敏感数据得到适当的保护。
安装
作为python包
要安装
pip install presidio-structured
入门
匿名化数据帧
import pandas as pd
from presidio_structured import StructuredEngine, PandasAnalysisBuilder
from presidio_anonymizer.entities import OperatorConfig
from faker import Faker # optionally using faker as an example
# Initialize the engine with a Pandas data processor (default)
pandas_engine = StructuredEngine()
# Create a sample DataFrame
sample_df = pd.DataFrame({'name': ['John Doe', 'Jane Smith'], 'email': ['john.doe@example.com', 'jane.smith@example.com']})
# Generate a tabular analysis which describes PII entities in the DataFrame.
tabular_analysis = PandasAnalysisBuilder().generate_analysis(sample_df)
# Define anonymization operators
fake = Faker()
operators = {
"PERSON": OperatorConfig("replace", {"new_value": "REDACTED"}),
"EMAIL_ADDRESS": OperatorConfig("custom", {"lambda": lambda x: fake.safe_email()})
}
# Anonymize DataFrame
anonymized_df = pandas_engine.anonymize(sample_df, tabular_analysis, operators=operators)
print(anonymized_df)
更多信息
项目详情
关闭
presidio_structured-0.0.2a0-py3-none-any.whl 的哈希
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 54cbf024d153806d06b81940269a09c45ce6154492048deb5f1dfb2e780a2558 |
|
MD5 | 389d8ac200695f5e087144ced1c68e6e |
|
BLAKE2b-256 | 16fc3c70c7d177711584b6af497de1036c77199612f8ec11dc3a277a51a62dd1 |