我是python和pandas的新手。在这里,我有一个像这样的数据框,
Id Offset feature
0 0 2
0 5 2
0 11 0
0 21 22
0 28 22
1 32 0
1 38 21
1 42 21
1 52 21
1 55 0
1 58 0
1 62 1
1 66 1
1 70 1
2 73 0
2 78 1
2 79 1
据此,我试图从列中获取前三个值以及其偏移量。
SO,输出将是
offset Feature
11 2
21 22
28 22
// Here these three values are `of the 0 which is at 32 offset`
In the same dataframe for next place where is 0
38 21
42 21
52 21
58 0
62 1
66 1
有什么办法可以使我得到这个? 谢谢 这将基于文档ID。