Python merge datasets X1(t), X2(t) -> X1(X2)
<p>I have some datasets (lets stay at 2 here) which are dependent on a common variable t, like X1(t) and X2(t). However X1(t) and X2(t) don't have to share the same t values or even have the same amount of datapoints.</p>

<p>For example they could look like:</p>

<pre><code>t1 = [2,6,7,8,10,13,14,16,17]
X1 = [10,10,10,20,20,20,30,30,30]

t2 = [3,4,5,6,8,10,11,14,15,16]
X2 = [95,100,100,105,158,150,142,196,200,204]
</code></pre>

<p>I am trying to create a new dataset YNew(XNew) (=X2(X1)) such that both datasets are linked without the shared variable t.
In this case it should look like:</p>

<pre><code>XNew = [10,20,30]
YNew = [100,150,200]
</code></pre>

<p>where to every occuring X1-value a corresponding X2-value (a mean value) is assigned.</p>

<p>Is there an easy already known way to achieve this(maybe with pandas)?
My first guess would be to find all t-values for a certain X1-value (in the example case the X1-value 10 would lie in the range 2,...,7) and then look for all X2-values in that range and get their mean value. Then you should be able to assign YNew(XNew).
Thanks for every advice!</p>

<p><strong>Update:</strong>
I added a graph, so maybe my intentions are a bit more clear. I want to assign the mean X2-value to the corresponding X1-value in the marked regions (where the same X1-values occur).</p>

<p><a href="http://i.stack.imgur.com/FMLaN.png" rel="nofollow">graph corresponding to example lists</a></p>