-
list of dataframes (ex. dfs = [df1, df2, …])
-
all dataframe columns is multiindex (ex. [(“something”, “id”,), (“something”, “age”), …])
-
i want to set “concept_id” to Key and create a new dataframe like this:
i try using python pandas, but it was hard. (multiindex is really hard)
what should i do?
- pd.concat(dfs, keys=[“concept_id”], join=”outer”, axis=1)
It didn’t come close to the correct answer.
- reduce(lambda df1, df2: pd.merge(df1, df2, on=”concept_id”, how=”outer”), dfs)
raised error : xlsxwriter.exceptions.OverlappingRange: Merge range ‘B1:J1’ overlaps previous merge range ‘B1:J1’.