python - Merge multiple DataFrames in an efficient manner -
i have plenty of dataframes need merged axis=0
, it's important find fast way op.
so far, try merge
, append
, these functions need assignment after merging df = df.append(df2)
, become slower , slower, there method can merge in place , more efficient?
assuming dataframes have same index, can use pd.concat
:
in [61]: df1 out[61]: 0 1 in [62]: df2 out[62]: b 0 2
create list of dataframes:
in [63]: df_list = [df1, df2]
now, call pd.concat
:
in [64]: pd.concat(df_list, axis=1) out[64]: b 0 1 2
Comments
Post a Comment