Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

most occurring string in column pandas

import numpy as np # importing numpy module
df["count"] = np.ones(len(df.index), dtype=int)
new_df = pd.pivot_table(data=df, index="col", values="count", aggfunc=np.sum)
new_df.sort_values(by=["count"],ascending=False).head(1)
 
PREVIOUS NEXT
Tagged: #occurring #string #column #pandas
ADD COMMENT
Topic
Name
2+4 =