I implemented to merge multiple dataframe referring to this page.
What I want to do is also specify the suffix for each dataframe like below.
However, I get ValueError: too many values to unpack (expected 2)
.
I understand that giving the tuple longer than 2 for suffix is causing this problem. But I have no idea how I can write code to fix this problem.
Can anyone tell me how to write?
def agg_df(dfList, suffix):
temp=reduce(lambda left, right: pd.merge(left, right, left_index=True, right_index=True,
how='outer', suffixes=suffix), dfList)
return temp
df=agg_df([df_cool, df_light, df_sp, df_hvac], ('_chiller', '_light', '_sp', '_hvac'))