Split array at value in numpy

I have a file containing data in the format:

0.0 x1
0.1 x2
0.2 x3
0.0 x4
0.1 x5
0.2 x6
0.3 x7
...

The data consists of multiple datasets, each starting with 0 in the first column (so x1,x2,x3 would be one set and x4,x5,x6,x7 another one). I need to plot each dataset separately so I need to somehow split the data. What would be the easiest way to accomplish this?

I realize I could go through the data line-by-line and split the data every time I encounter a 0 in the first column but this seems very inefficient.

12
задан pafcu 11 March 2011 в 14:37
поделиться