How to get start and end indices of consecutive groups of data in pandas?

后端 未结 0 608
野趣味
野趣味 2020-12-10 23:45

Given

import pandas as pd

df = pd.DataFrame({
    "a":  [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, ],
})
print(df)
相关标签:
回答
  • 消灭零回复
提交回复
热议问题