我想找到比列中当前行值更大的先前行数的计数,并将其存储在新列中。这就像一个滚动计数回到列的开头。下面所需的示例输出显示了给定的值列和我要创建的计数列。
Desired Output: Value Count 5 0 7 0 4 2 12 0 3 4 4 3 1 6
我计划将此代码与大型数据帧一起使用,以便以最快的方式表示赞赏。
python loops countif pandas
countif ×1
loops ×1
pandas ×1
python ×1