I would like to know how to delete elements of my array that contain the value 0.
My code is as follows:
EL1_array = list(zip(time_list, EL1_list))
print(EL1_array)
for (i,j) in EL1_array:
if j == 0:
EL1_array.remove(j)
print(EL1_array)
This is a sample of the output (the whole thing is too big to post here I think):
[(0.0, 177.051636), (0.01, 0.0), (0.02, 0.0), (0.03, 0.0), (0.04, 0.0), (0.05, 0.0), (0.06, 233.906097), (0.07, 242.052551), (0.08, 249.754761), (0.09, 257.026062), (0.1, 263.887482), (0.11, 270.364075), (0.12, 276.482758), (0.13, 282.270172), (0.14, 287.751526), (0.15, 292.94986), (0.16, 297.885254), (0.17, 302.574249), (0.18, 307.029663), (0.19, 311.259705), (0.2, 315.267456), (0.21, 319.049622), (0.22, 322.595276), (0.23, 325.883636), (0.24, 328.881287), (0.25, 331.538147), (0.26, 333.782562), (0.27, 335.515656), (0.28, 336.606415), (0.29, 336.892151),
I am trying to remove all the elements (i, j) that contain j = 0.
The two lists I have are time_list and EL1_list which both contain 300 elements. EL1 is the list that contains the zeroes I want to remove. The problem is I want to plot the EL1_lit against the time_list without the zeroes included hence my desire to remove them from the EL1_list. So my thinking was to create an array of the two lists and then remove the zeroes with the corresponding time element from the time_list so as they each contain the same number of elements.