I'm novice with python,
I have a data set with some rows and a column "emaildomain" like this:
1 gmail.com
2 hotmail.com
3 yahoo.com
4 mydomain.com
5 gmail.com
..
I would like to change all the email-domain with less the 50 occurrences with a value 'other'
I'm trying to do a for but I don't know where I'm wrong.
s = df["emaildominio"].value_counts()
x = s[s>50]
for z in df:
if z not in x:
df["emaildominio"] = df["emaildominio"].replace([z],'other')
else:
continue
where am I wrong?