Hi all
I have a dataset where the -1 means the point where I need to stop reading.
For example the dataset looks like that:
For doing that I think I need in pandas perhaps a way to return me per row the index where the first -1 occurs.
How I can do something like that in a nice way in pandas (so avoid the long for loop option?)
I would like to thank you in advance for your help.
Regards
Alex
I have a dataset where the -1 means the point where I need to stop reading.
For example the dataset looks like that:
0 1 2 3 4 5 0 58 68 58 59 -1 -1 1 59 69 59 -1 -1 -1 2 93 94 93 33 -1 -1 3 58 59 58 68 -1 -1 4 92 94 92 33 -1 -1where the -1 at column 4 means, read from 0:3. Actually I want to return the length per row. So first row has length of 4 (4 elements until the -1). Row two has length 3. Row three has length 4 and so on.
For doing that I think I need in pandas perhaps a way to return me per row the index where the first -1 occurs.
How I can do something like that in a nice way in pandas (so avoid the long for loop option?)
I would like to thank you in advance for your help.
Regards
Alex