跳转到主要内容

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 (11.3 kB 查看哈希)

上传时间 Python 3

由以下支持