如何删除python中不可用的数据?

时间:2018-07-07 14:43:04

标签: python dataset accelerometer

我有一组加速度计数据。此数据与前进然后停止然后转弯再返回有关。我不想停止和转弯的数据,我想从我的数据集中删除该数据。您能否让我知道如何在python中执行此操作?the figure of this data

1 个答案:

答案 0 :(得分:1)

我真的看不到您的代码,因此我的回答非常有限。我假设您想知道如何删除列表中的一系列元素(如果我错了,请纠正我)。在下面的代码中,您必须提供要删除的索引范围的值。

dataset = [10, 20, 50, 15, 50, 50, 901, 1000, 800]   #whatever your dataset is
startpop = 3  #the starting index of the data to be erased
endpop = 7    #the ending index of the data to be erased

del dataset[startpop:endpop]