1
1
import anonypy
2
2
from anonypy import util
3
- from anonypy import mondrian
4
3
import pandas as pd
5
4
6
5
names = (
@@ -41,7 +40,7 @@ def test_build_anonymized_dataset():
41
40
df [name ] = df [name ].astype ('category' )
42
41
43
42
feature_columns = ['age' , 'education-num' ]
44
- m = mondrian .Mondrian (df , feature_columns )
43
+ m = anonypy .Mondrian (df , feature_columns )
45
44
finished_partitions = m .partition (anonypy .is_k_anonymous )
46
45
47
46
print (len (finished_partitions ))
@@ -66,13 +65,13 @@ def test_get_spans():
66
65
df [name ] = df [name ].astype ('category' )
67
66
68
67
feature_columns = ['age' , 'education-num' ]
69
- m = mondrian .Mondrian (df , feature_columns )
68
+ m = anonypy .Mondrian (df , feature_columns )
70
69
spans = m ._get_spans (df .index )
71
70
72
71
assert {'age' : 73 , 'education-num' : 15 } == spans
73
72
74
73
feature_columns = ['sex' , 'income' , 'native-country' , 'race' ]
75
- m = mondrian .Mondrian (df , feature_columns )
74
+ m = anonypy .Mondrian (df , feature_columns )
76
75
spans = m ._get_spans (df .index )
77
76
78
77
assert {'income' : 2 , 'sex' : 2 , 'native-country' : 41 , 'race' : 5 } == spans
0 commit comments