我有像这样的简单数据集。
import pandas as pd
import numpy as np
pd.set_option('display.max_rows', 10)
date_index = pd.date_range('2020-05-01','2020-06-01')
types = ['A','B','C']
status = {'Date':['2020-05-04','2020-05-10','2020-05-17',
'2020-05-03','2020-05-09','2020-05-12',
'2020-05-01','2020-05-06','2020-05-10'],
'Type':['A','A','A',
'B','B','B',
'C','C','C'],
'ind1':[1,0,3,
2,5,6,
1,8,0,],
'ind2':[6,5,1,
3,1,1,
2,2,8]}
df = pd.DataFrame.from_dict(data=status)
df['Date'] = pd.to_datetime(df['Date'])
df = df.set_index(['Date','Type'])
ind = pd.MultiIndex.from_product([date_index,types],names=['Date','Type'])
df2 = pd.DataFrame(index=ind)
我要整合这两个数据集
df_cons = df2.join(df)
我的问题是: