I have a df:
domain orgid
csyunshu.com 108299
dshu.com 108299
bbbdshu.com 108299
cwakwakmrg.com 121303
ckonkatsunet.com 121303
I would like to add a new column with replacing the domain column with numeric identifiers for orgid:
domain orgid domainid
csyunshu.com 108299 1
dshu.com 108299 2
bbbdshu.com 108299 3
cwakwakmrg.com 121303 1
ckonkatsunet.com 121303 2
I already tried this line, but this does not give the result that I want:
df.groupby('orgid').count['domain'].reset_index()
Does anyone help?
source
share