I have a simple dataframe which I would like to bin for every 3 rows.
It looks like this:
col1 0 2 1 1 2 3 3 1 4 0
The answer from Roman Pekar was not working for me. I imagine that this is because of differences between Python2 and Python3. This worked for me in Python3:
Python2
Python3
>>> df.groupby(df.index // 3).mean() col1 0 2.0 1 0.5