How to divide a list into a given time step
<p>I have a list, e.g.</p>

<pre><code>event = [0.1, 0.6, 1.5, 3.4, 3.8, 4.1, 6.2, 8.5, 9.1, 9.5]  
</code></pre>

<p>Where each item in the list is a event happened at time 0.1, time 0.6 etc.</p>

<p>I want to divide the list into a delta t, but how can this be done? All the other threads I have seen only discussed about splitting the list into equal parts, but in this case if we have delta t = 1, I want a list where 0.1 and 0.6 is together, and another for 1.5 etc.</p>

<p>First, make sure you list is sorted. Once you've done this, iterate through the list. Starting from the first value, create a new list containing all values from the first value to the final value that rests within the desired range. Then, jump to the index of that value and repeat. Given a delta t of 1, the list </p>

<pre><code>event = [0.1, 0.6, 1.5, 3.4, 3.8, 4.1, 6.2, 8.5, 9.1, 9.5]  
</code></pre>

<p>will concatenate [0.1, 0.6] into a smaller list on the first step and begin the second step at [1.5], because 1.5 is the first value out of the range 1. Repeat this procedure until you have all of the smaller lists you need.</p>

python list