I am a python new bie.
I have two list of lists like this:
A = List[List[float,float]]
B = List[List[float,float]]
both different sizes Ex :
A has [time, value]
B has [start_time, end_time]
A = [[0.0,10.0] , [1.0,10.0], [2.0,10.0], [3.0,10.0], [4.0,10.0], [5.0,10.0], [6.0,10.0]]
B = [[0.0,2.0], [5.0,6.0]]
What I am trying to do is :
if A has a time which is not in B, I should make the corresponding 'value' in A to zero.
So output would be :
[[0.0,10.0] , [1.0,10.0], [2.0,10.0], [3.0,0.0], [4.0,0.0], [5.0,10.0], [6.0,10.0]]
i.e if a time segment in B has no corresponding time value present in A, the value corresponding to that time should be made zero. In this case, the values between 2 and 5 are there in B , so partner values of'3' and '4' in A are made to zeroes.
Please tell me how to do it. I have referred here: Python - How to change values in a list of lists? and List of lists into numpy array
So One idea i got was to convert B into single list and then compare values from AA and A. However I haven't made much progress.
AA = numpy.hstack(B) # for getting array of times
for i in 1: len(AA):
if (AA[i]==A[