Combine dictionary of dataframes into 1 single dataframe

前端 未结 2 859
不思量自难忘°
不思量自难忘° 2021-01-05 05:36

I am looking for a solution to put all my dataframes which are in a dictionary into 1 single giant dataframe. I am relatively new to Python so I am unable to understand how

相关标签:
2条回答
  • 2021-01-05 06:22
    df_list = [ v for k,v in dodf.items()] 
    df = pd.concat(df_list ,axis=1)
    

    does this work? It also depends whether the concat is by columns or by rows...

    0 讨论(0)
  • 2021-01-05 06:29

    I think need concat with dict comprehension:

    dodf = {f: pd.read_excel(f, sheet_name=None) for f in files}
    df = pd.concat([pd.concat(v) for k,v in dodf.items()])
    
    0 讨论(0)
提交回复
热议问题