I have DataFrames that represent data from two different sensors:
In[0]: df0
Out[0]:
time foo
0 0.1 123
1 1.0 234
2 2.1 345
3 3.1 456
4 3.9 567
5 5.1 678
In[0]: df1
Out[0]:
time bar
0 -0.9 876
1 -0.1 765
2 0.7 654
3 2.1 543
4 3.0 432
The sensors provide a measure (foo or bar) and a timestamp (time) for each events that they are monitoring. A couple things to note:
- the timestamps are close, but not identical
- the range over which data was collected is different across sensors (i.e. they were turned on and turned off independently)
I'm trying to align df0 and df1 to get the following:
In[3]: df3
Out[3]:
time_df0 foo time_df1 bar
0 nan nan -0.9 876
1 0.1 123 -0.1 765
2 1.0 234 0.7 654
3 2.1 345 2.1 543
4 3.1 456 3.0 432
5 3.9 567 nan nan
6 5.1 678 nan nan