附录一
data = {
value : [1,9,6,7,3, 2,4,5,1,9]
}
每一行,我想找到比目前增加的最新内容的逐年增长。
因此,我的预期产出是:
[None, 0, 1, 2, 1, 1, 3, 4, 1, 0]
- the first element
1
has no previous element, so I wantNone
in the result - the next element
9
is at least as large than all its previous elements, so I want0
in the result - the next element
6
, has its previous element9
which is larger than it. The distance between them is1
. So, I want1
in the result here.
我知道,我可以在沙尔的 lo中这样做(如果我写延期的话,可在C/Rust)。
我的问题是:能否解决这一完全使用数据机操作? anda或极地,要么是罚款。 但只有数据基操作。
因此,以下人士无一可查:
apply
map_elements
map_rows
iter_rows
- Python for loops which loop over the rows and extract elements one-by-one from the dataframes