Build dict from list of tuples combining two multi index dfs and column index
问题 I have two multi-index dataframes: mean and std arrays = [['A', 'A', 'B', 'B'], ['Z', 'Y', 'X', 'W']] mean=pd.DataFrame(data={0.0:[np.nan,2.0,3.0,4.0], 60.0: [5.0,np.nan,7.0,8.0], 120.0:[9.0,10.0,np.nan,12.0]}, index=pd.MultiIndex.from_arrays(arrays, names=('id', 'comp'))) mean.columns.name='Times' std=pd.DataFrame(data={0.0:[10.0,10.0,10.0,10.0], 60.0: [10.0,10.0,10.0,10.0], 120.0:[10.0,10.0,10.0,10.0]}, index=pd.MultiIndex.from_arrays(arrays, names=('id', 'comp'))) std.columns.name='Times'