Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can pass your <code>inArr</code> to a pandas Dataframe:</p> <pre><code>df = pd.DataFrame(inArr, columns=['time', 'value']) </code></pre> <ul> <li><em>num seconds between each successive pair of timestamps:</em> <code>df['time'].diff()</code></li> <li><em>median delay</em>: <code>df['time'].diff().median()</code></li> <li><em>creates an array of the correct size</em> (I think that's taken care of?)</li> <li><em>presumes the first time period starts at half the median value before the first timestamp (putting the measurement in the middle of the time period)</em>; I don't know what you mean here</li> <li>averages values that happen to go into the same time bucket</li> </ul> <p>For several of these problems it may make since to convert your seconds to <code>datetime</code> and set it as the index:</p> <pre><code>In [39]: df['time'] = pd.to_datetime(df['time'], unit='s') In [41]: df = df.set_index('time') In [42]: df Out[42]: value time 2013-12-30 20:27:22 12.3 2013-12-30 20:27:42 11.1 2013-12-30 20:28:01 12.8 </code></pre> <p>Then to handle multiple values in the same time, use <code>groupby</code>.</p> <pre><code>In [49]: df.groupby(level='time').mean() Out[49]: value time 2013-12-30 20:27:22 12.3 2013-12-30 20:27:42 11.1 2013-12-30 20:28:01 12.8 </code></pre> <p>It's the same since there aren't any dupes.</p> <p>Not sure what you mean about the last two.</p> <p>And your desired output seems to contradict what you wanted earlier. You values with the same timestamp should be averaged, and now you want them all? Maybe clear that up a bit.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload