I have a dataframe like this.
A,B
1,2
3,4
5,6
7,8
9,10
11,12
13,14
I would like to split this above dataframe. The splitted dataframe should contains every three rows. The first dataframe splitted can contain from index 0 to index 2. Second contains from index 1 to index and so on.
A,B
1,2
3,4
5,6
A,B
3,4
5,6
7,8
A,B
5,6
7,8
9,10
and so on.
I have been using forloop and then using the iloc and then adding those splitted dataframe into the list.
I am looking if there is some vectorized method to split that above dataframe in pandas. The dataframe is huge and using forloop through each rows is quite slow.