Skip to main content

pyCANON, A Python library to check the level of anonymity of a dataset

Project description

License Documentation Status Pipeline Status

pyCANON is a Python library and CLI to assess the values of the parameters associated with the most common privacy-preserving techniques via anonymization.

Authors: Judith Sáinz-Pardo Díaz and Álvaro López García (IFCA - CSIC).

Installation

We recommend to use Python3 with virtualenv:

virtualenv .venv -p python3
source .venv/bin/activate

Then run the following command to install the library and all its requirements:

pip install pycanon

Documentation

The pyCANON documentation is hosted on Read the Docs.

Getting started

Example using the adult dataset:

import pandas as pd
from pycanon import anonymity, report

FILE_NAME = "adult.csv"
QI = ["age", "education", "occupation", "relationship", "sex", "native-country"]
SA = ["salary-class"]
DATA = pd.read_csv(FILE_NAME)

# Calculate k for k-anonymity:
k = anonymity.k_anonymity(DATA, QI)

# Print the anonymity report:
report.print_report(DATA, QI, SA)

Description

pyCANON allows to check if the following privacy-preserving techniques are verified and the value of the parameters associated with each of them.

Technique

pyCANON function

Parameters

Notes

k-anonymity

k_anonymity

k: int

(α, k)-anonymity

alpha_k_anonymity

α: float k:int

ℓ-diversity

l_diversity

: int

Entropy ℓ-diversity

entropy_l_diversity

: int

Recursive (c,ℓ)-diversity

recursive_c_l_diversity

c: int : int

Not calculated if ℓ=1

Basic β-likeness

basic_beta_likeness

β: float

Enhanced β-likeness

enhanced_beta_likeness

β: float

t-closeness

t_closeness

t: float

For numerical attributes the definition of the EMD (one-dimensional Earth Mover’s Distance) is used. For categorical attributes, the metric “Equal Distance” is used.

δ-disclosure privacy

delta_disclosure

δ: float

More information can be found in this paper.

Citation

If you are using pyCANON you can cite it as follows:

@article{sainzpardo2022pycanon,
   title={A Python library to check the level of anonymity of a dataset},
   author={S{\'a}inz-Pardo D{\'\i}az, Judith and L{\'o}pez Garc{\'\i}a, {\'A}lvaro},
   journal={Scientific Data},
   volume={9},
   number={1},
   pages={785},
   year={2022},
   publisher={Nature Publishing Group UK London}}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycanon-1.0.1.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

pycanon-1.0.1-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file pycanon-1.0.1.tar.gz.

File metadata

  • Download URL: pycanon-1.0.1.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pycanon-1.0.1.tar.gz
Algorithm Hash digest
SHA256 418e1a42ef5701bb30f90500bbcf523eb629c8b5fb02b575cde7ffd35158cca7
MD5 9595a7f97182e2bc1ae40cde51c4f3b4
BLAKE2b-256 6c536612aa942a6a6e6f8991ac1b6e1d30ee60736f181d9ae2fd46c09d9ee7bb

See more details on using hashes here.

File details

Details for the file pycanon-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pycanon-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pycanon-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d46d1f125f28c9623e60df6315ecd2300557227bc3e62efbb4af5f7340888d16
MD5 1850933e6c536ecd4cae207018663e5c
BLAKE2b-256 e7c43876a78212ae02ea6352e6baa066a6383b9eab56bf9820d8666f02073df7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page