0
time price
2015-11-18 00:00:00.000 42.02
2015-11-18 00:00:00.021 42.01
2015-11-18 00:00:00.126 42.01
2015-11-18 00:00:00.127 42.02
Name: price, dtype: float64
time price
2015-11-18 00:00:00.000 106.82
2015-11-18 00:00:00.020 106.82
2015-11-18 00:00:00.021 106.82
2015-11-18 00:00:00.207 106.82
2015-11-18 00:00:00.325 106.82
Name: price, dtype: float64
我想合併這兩個獨特的DataFrames(比方說,一個是stock1,一個是stock2)到多指數(由stock1和stock2)數據幀如下:有序合併兩個時間序列(每個都有獨特的DateTimeIndex)和填充?
STOCK1 STOCK2
time price
2015-11-18 00:00:00.000 106.82 42.02
2015-11-18 00:00:00.126 106.82 42.01
2015-11-18 00:00:00.127 106.82 42.02
2015-11-18 00:00:00.020 106.82 42.02
2015-11-18 00:00:00.021 106.82 42.01
2015-11-18 00:00:00.021 106.82 42.01
2015-11-18 00:00:00.207 106.82 42.01
2015-11-18 00:00:00.325 106.82 42.01
當我嘗試首先製作一個多重索引,我得到
ValueError: cannot reindex from a duplicate axis
嘗試ordered_merge,但它沒有得到正確的結果。
首先通過他們的工會重新索引Stock1和Stock2然後多重索引他們是否有意義?什麼是最好的過程來實現結果?