I got 2 Dataframes. The first has a Timeindex and a Timecolumn. The second has a Timeindex, but its columns are irrelevant.
Both timeindex are sorted in timeorder, but dont have a regularity inside. (e.g. holidays or specific dates are left out)
Now I need to reset the Timecolumn of the first Dataframe to "one position back in thesecond Df's-TimeIndex".
I also need to reset the TimeIndex of the first Dataframe to "one position back in thesecond Df's-TimeIndex".
first df
t1
2014-10-13 00:00:00 2014-10-13 00:00:00
2014-10-14 00:00:00 2014-10-14 00:00:00
2014-10-15 00:00:00 2014-10-15 00:00:00
2014-10-16 00:00:00 2014-10-16 00:00:00
2014-10-17 00:00:00 2014-10-17 00:00:00
...
2016-02-22 16:00:00 2016-02-23 14:00:00 # in this later samples u can see
2016-02-22 17:00:00 2016-02-23 14:00:00 # that there is no common pattern
2016-02-22 18:00:00 2016-02-23 14:00:00
2016-02-22 19:00:00 2016-02-22 19:00:00
2016-02-22 20:00:00 2016-02-22 20:00:00
[604 rows x 1 columns]
second df:
Val
Time
2014-10-10 00:00:00 ...
2014-10-13 00:00:00 ...
2014-10-14 00:00:00 ...
2014-10-15 00:00:00 ...
2014-10-16 00:00:00 ...
... ... ... ... ...
2016-02-23 16:00:00 ...
2016-02-23 17:00:00 ...
2016-02-23 18:00:00 ...
2016-02-23 19:00:00 ...
2016-02-23 20:00:00 ...
expected output:
It is like I want to get the numberLocation of the ValueColumn from the first Dataframe -> in the TimeIndex of the second Dataframe , then subtract 1 of this numberIndex, so that it will be "shifted back" in terms of the Second df's index. And then get the TimeIndex-values of the second df which are located at the new numberIndex, to fill the ValueColumn of the first Index with them.
t1
2014-10-13 00:00:00 2014-10-10 00:00:00
2014-10-14 00:00:00 2014-10-13 00:00:00
2014-10-15 00:00:00 2014-10-14 00:00:00
2014-10-16 00:00:00 2014-10-15 00:00:00
2014-10-17 00:00:00 2014-10-16 00:00:00
...