I have large pandas dataframe, I would like to count the occurrence of each unique value in it, I try following but it takes to much time and memory usage. How can I do it in a pythonic way?
pack=[]
for index,row in packets.iterrows ():
pack.extend(pd.Series(row).dropna().values.tolist())
unique, count= np.unique(pack, return_counts=True)
counts= np.asarray((unique, count))