I'd like to combine all 3 into a single multi-index dataframe, where the old index is now a column, and the new index is now ['DF1', 'DF2', 'DF3']. old_index valuenew_index DF1 0 a0 1 a1 2 a2 3 a3 DF2 0 b0 1 b1 2 b2 3 b3 DF3 0 c0 1 c1 2 c2 3 c3最简单的方法是什么?推荐答案 IIUCl=[DF1,DF2,DF3]pd.concat(l,keys= ['DF1', 'DF2', 'DF3'],axis=0).reset_index(level=1) 这篇关于将多个 pandas 数据框组合成一个多索引数据框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-06 05:12