I have a long dataframe with only one column and around 800k rows. my data frame looks like this
54
53
53
53
53
...
0
0
0
So what I need is to count the number of occurrences of each value and saving this into a dataframe so the result would be something like this
54 1
53 1000
52 800
...
0 100000
I have tried using df.groupby(0)
but it only returns an object. How can I get a two-column dataframe (or 1 column and a row-index showing the values)?