Anonymizing data / replacing names

后端 未结 3 735
一整个雨季
一整个雨季 2021-01-24 06:13

Normally I anonymize my data by using hashlib and using the .apply(hash) function.

Now im trying a new approach, imagine I have to following df called \'data\':

3条回答
  •  旧巷少年郎
    2021-01-24 06:39

    labels, uniques =  pd.factorize(df['name'])
    labels = ['person_'+str(l) for l in labels]
    df['contributor_anonymized'] = labels
    

提交回复
热议问题