title: how to conditionally replace values in list of lists in python
body: <p>I am a python new bie.<br>
  I have two list of lists like this:  </p>
  
  <pre><code>A = List[List[float,float]]   
  B = List[List[float,float]]  
  </code></pre>
  
  <p>both different sizes
  Ex :   </p>
  
  <pre><code>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]]     
  </code></pre>
  
  <p>What I am trying to do is :<br>
   if A has a time which is not in B, I should make the corresponding 'value' in A to zero. </p>
  
  <p>So output would be : </p>
  
  <pre><code>[[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]]
  </code></pre>
  
  <p>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.</p>
  
  <p>Please tell me how to do it.
  I have referred here: <a href="https://stackoverflow.com/questions/13752461/python-how-to-change-values-in-a-list-of-lists">Python - How to change values in a list of lists?</a>  and <a href="https://stackoverflow.com/questions/10346336/list-of-lists-into-numpy-array">List of lists into numpy array</a>  </p>
  
  <p>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. </p>
  
  <pre><code>AA = numpy.hstack(B) # for getting array of times
  for i in 1: len(AA):
       if (AA[i]==A[
  </code></pre>