我有一個Python列表/ EXCEL,看起來測距每一組連續值的長度一樣使用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
我已經在Excel中嘗試了" COUNTIF($D2:D$2,D2)"
這個公式幫助我找到第n個值,但是我不確定如何找到每組連續值的長度。
上述問題如何在Excel和Python中實現?
謝謝你這麼多列。這很好。 – richie 2013-03-04 13:00:37