I have to following df:
Col1 Col2
test Something
test2 Something
test3 Something
test Something
test2 Something
test5 Something
I want to get
Col1 Col2 Occur
test Something 2
test2 Something 2
test3 Something 1
test Something 2
test2 Something 2
test5 Something 1
I've tried to use:
df["Occur"] = df["Col1"].value_counts()
But it didn't help. I've got Occur column full of 'NaN'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…