开满天机
您可以使用 pd.concat:In [15]: df1 = pd.DataFrame({'month': [1, 1, 1, 1, 1, 1], ...: 'day': [2]*6, ...: 'station': ['A', 'B', 'C', 'D', 'E', 'F'], ...: 'mean': [55, 40, 84, 31, 44, 12], ...: 'sd': [1., 2., 1.2, 3., 4., 0.7]}).set_index(["station", "month", "day"])In [16]: df2 = pd.DataFrame({'month': [2, 2, 2, 2, 2, 2], ...: 'day': [2]*6, ...: 'station': ['A', 'B', 'C', 'D', 'G', 'F'], ...: 'mean': [55, 40, 84, 31, 15, 12], ...: 'sd': [1., 2., 1.2, 3.,1, 0.7]}).set_index(["station", "month", "day"])In [19]: pd.concat([df1,df2]).sort_index()Out[19]: mean sdstation month dayA 1 2 55 1.0 2 2 55 1.0B 1 2 40 2.0 2 2 40 2.0C 1 2 84 1.2 2 2 84 1.2D 1 2 31 3.0 2 2 31 3.0E 1 2 44 4.0F 1 2 12 0.7 2 2 12 0.7G 2 2 15 1.0