Trim signal boundary fragments, which may not be statistical outliers?

93 Views Asked by At

I'm dealing with quite a bunch of speech signals, which are pre-segmented manually. However, the segmentations are not precise at all so that there are always some annoying fragments at the beginning and end. Following is an example.

0     13.806404
1     13.681412
2     14.056404
3           NaN
4     15.025136
5     15.072026
6     15.072026
7           NaN
8           NaN
9           NaN
10          NaN
11          NaN
12          NaN
13          NaN
14          NaN
15          NaN
16          NaN
17          NaN
18    17.712722
19    17.993896
20    18.040795
21    18.056421
22    18.087629
23    18.165769 
24    18.212630
25    18.228282
26    18.243920
27    18.243920
28    18.243920
29    18.228282
30    18.212630
31    18.197084
32    18.150182
33    18.103274
34    18.197084
35    NaN
36    18.540826
37    18.712610
38    18.884508
39    18.868914
40    NaN
41    18.806456
42    18.743890
43    NaN
44    18.728286
45    18.743890
46    18.790792
47    NaN
48    NaN
49    NaN
50    NaN
51    NaN
52    27.053239
53    25.976291
dtype: float64

I'm looking for an effective method to remove the fragments before the 6th element and after the 52th element in the above example list.

Note that these elements may not by statistical outliers, which I treated them as, but the performance is not good...

Many many thanks!

1

There are 1 best solutions below

1
On

you can keep line 6 et 52

df.ix[6:52]

ix will keep line 6 to 52 base on your index.