Group by consecutive index numbers
This is a groupby
+ pivot_table
m = df.index.to_series().diff().ne(1).cumsum()
(df.assign(key=df.groupby(m).cumcount())
.pivot_table(index='key', columns=m, values=0))
1 2
key
0 19218.965703 19279.216956
1 19247.621650 19330.087371
2 19232.651322 19304.316973
Here is one way:
from more_itertools import consecutive_groups
final=pd.concat([df.loc[i].reset_index(drop=True)
for i in consecutive_groups(df.index)],axis=1)
final.columns=range(len(final.columns))
print(final)
0 1
0 19218.965703 19279.216956
1 19247.621650 19330.087371
2 19232.651322 19304.316973