我有一个数据框df
,该数据框以以下格式的datetime对象索引(巨大的数据集):
B1in (ºC) B1out (ºC) ... ToutIC (ºC) Ttank (ºC)
2005-02-01 00:01:14 33.531250 38.281250 ... 18.921875 NaN
2005-02-01 00:02:14 33.531250 38.218750 ... 18.937500 NaN
2005-02-01 00:03:14 33.468750 38.156250 ... 18.921875 NaN
2005-02-01 00:04:14 33.468750 38.093750 ... 18.921875 NaN
...
2005-02-02 00:01:14 33.531250 38.281250 ... 18.921875 NaN
2005-02-02 00:02:14 33.531250 38.218750 ... 18.937500 NaN
2005-02-02 00:03:14 33.468750 38.156250 ... 18.921875 NaN
2005-02-02 00:04:14 33.468750 38.093750 ... 18.921875 NaN
...
2005-02-03 00:01:14 33.531250 38.281250 ... 18.921875 NaN
2005-02-03 00:02:14 33.531250 38.218750 ... 18.937500 NaN
2005-02-03 00:03:14 33.468750 38.156250 ... 18.921875 NaN
2005-02-03 00:04:14 33.468750 38.093750 ... 18.921875 NaN
...
还有另一个用日期对象索引的数据框ref
:
Representative data System working
2005-02-01 NO OFF
2005-02-02 YES OFF
2005-02-03 YES ON
...
我想将它们加入新的数据框res
中,例如对于每个日期,每次的新列都相同。示例:
B1in (ºC) B1out (ºC) ... ToutIC (ºC) Ttank (ºC) Representative data System working
2005-02-01 00:01:14 33.531250 38.281250 ... 18.921875 NaN NO OFF
2005-02-01 00:02:14 33.531250 38.218750 ... 18.937500 NaN NO OFF
2005-02-01 00:03:14 33.468750 38.156250 ... 18.921875 NaN NO OFF
2005-02-01 00:04:14 33.468750 38.093750 ... 18.921875 NaN NO OFF
...
2005-02-02 00:01:14 33.531250 38.281250 ... 18.921875 NaN YES OFF
2005-02-02 00:02:14 33.531250 38.218750 ... 18.937500 NaN YES OFF
2005-02-02 00:03:14 33.468750 38.156250 ... 18.921875 NaN YES OFF
2005-02-02 00:04:14 33.468750 38.093750 ... 18.921875 NaN YES OFF
...
2005-02-03 00:01:14 33.531250 38.281250 ... 18.921875 NaN YES ON
2005-02-03 00:02:14 33.531250 38.218750 ... 18.937500 NaN YES ON
2005-02-03 00:03:14 33.468750 38.156250 ... 18.921875 NaN YES ON
2005-02-03 00:04:14 33.468750 38.093750 ... 18.921875 NaN YES ON
有人可以用一种优雅的方式解决这个问题吗? 谢谢!