Skip to content

Commit 9ac8f70

Browse files
author
glassonion1
committed
modify readme file
1 parent 7135e81 commit 9ac8f70

File tree

4 files changed

+48
-7
lines changed

4 files changed

+48
-7
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1-
# anonypy
1+
# AnonyPy
22
Anonymization library for python
3+
4+
## Install
5+
```
6+
$ pip install anonypy
7+
```
8+
9+
## Usage
10+
```python
11+
import anonypy
12+
import pandas as pd
13+
14+
def main():
15+
path = 'data/adult.test.txt'
16+
df = pd.read_csv(path, sep=', ', names=names, engine='python')
17+
18+
for name in categorical:
19+
df[name] = df[name].astype('category')
20+
21+
feature_columns = ['age', 'education-num']
22+
m = anonypy.Mondrian(df, feature_columns)
23+
partitions = m.partition(anonypy.is_k_anonymous)
24+
print(partitions)
25+
```

anonypy/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from anonypy.anonypy import *
2+
from .mondrian import Mondrian

setup.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
from setuptools import setup, find_packages
2+
from os import path
3+
4+
here = path.abspath(path.dirname(__file__))
5+
6+
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
7+
long_description = f.read()
28

39
setup(
410
name='anonypy',
5-
version='0.1',
6-
packages=find_packages()
11+
version='0.0.1',
12+
packages=find_packages(),
13+
author='glassonion1',
14+
author_email='glassonion999@gmail.com',
15+
description='Anonymization library for python',
16+
long_description=long_description,
17+
long_description_content_type='text/markdown',
18+
keywords='k-anonymity l-diversity t-closeness',
19+
classifiers=[
20+
"Programming Language :: Python :: 3.8",
21+
"Programming Language :: Python :: 3.9",
22+
"License :: OSI Approved :: MIT License",
23+
"Operating System :: OS Independent",
24+
],
725
)

tests/anonypy_test.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import anonypy
22
from anonypy import util
3-
from anonypy import mondrian
43
import pandas as pd
54

65
names = (
@@ -41,7 +40,7 @@ def test_build_anonymized_dataset():
4140
df[name] = df[name].astype('category')
4241

4342
feature_columns = ['age', 'education-num']
44-
m = mondrian.Mondrian(df, feature_columns)
43+
m = anonypy.Mondrian(df, feature_columns)
4544
finished_partitions = m.partition(anonypy.is_k_anonymous)
4645

4746
print(len(finished_partitions))
@@ -66,13 +65,13 @@ def test_get_spans():
6665
df[name] = df[name].astype('category')
6766

6867
feature_columns = ['age', 'education-num']
69-
m = mondrian.Mondrian(df, feature_columns)
68+
m = anonypy.Mondrian(df, feature_columns)
7069
spans = m._get_spans(df.index)
7170

7271
assert {'age': 73, 'education-num': 15} == spans
7372

7473
feature_columns = ['sex', 'income', 'native-country', 'race']
75-
m = mondrian.Mondrian(df, feature_columns)
74+
m = anonypy.Mondrian(df, feature_columns)
7675
spans = m._get_spans(df.index)
7776

7877
assert {'income': 2, 'sex': 2, 'native-country': 41, 'race': 5} == spans

0 commit comments

Comments
 (0)