我有一个看起来像的 python 列表/excel 范围
[0,0,0,0,1,1,0,0,1,1,1,1,1,0,1,0,0,0,0,0,0,0,1,1,0,0,0] .
我想要以下输出:
length of 1st set of zeros - 4
length of 2nd set of zeros - 2
length of 3rd set of zeros - 1
length of 4th set of zeros - 7
length of 5th set of zeros - 3
我" COUNTIF($D2:D$2,D2)"
在 Excel 中尝试了帮助我找到第 n 个值的公式,但我不确定如何找到每组连续值的长度。
以上如何在 Excel 和 Python 中实现?