1import pandas as pd
2from functools import reduce
3
4# compile the list of dataframes you want to merge
5data_frames = [df1, df2, df3]
6df_merged = reduce(lambda left,right: pd.merge(left,right,on=['key_col'],
7 how='outer'), data_frames)
8
1# compile the list of dataframes you want to merge
2data_frames = [df1, df2, df3]
3
4df_merged = reduce(lambda left,right: pd.merge(left,right,on=['DATE'],
5 how='outer'), data_frames)
6
7# if you want to fill the values that don't exist in the lines of merged dataframe simply fill with required strings as
8
9df_merged = reduce(lambda left,right: pd.merge(left,right,on=['DATE'],
10 how='outer'), data_frames).fillna('void')
11
1from functools import reduce
2
3Name of a column in all dataframes is 'DATE'
4
5df_merged = reduce(lambda left,right: pd.merge(left,right,on=['DATE'],
6 how='outer'), data_frames)
7
8# if you want to fill the values that don't exist in the lines of merged dataframe simply fill with required strings as
9
10df_merged = reduce(lambda left,right: pd.merge(left,right,on=['DATE'],
11 how='outer'), data_frames).fillna('void')
12
1from functools import reduce
2import pandas as pd
3
4dfs = [df1, df2, df3, ...]
5nan_value = 0
6
7# solution 1 (fast)
8result_1 = pd.concat(dfs, join='outer', axis=1).fillna(nan_value)
9
10# solution 2
11result_2 = reduce(lambda df_left,df_right: pd.merge(df_left, df_right,
12 left_index=True, right_index=True,
13 how='outer'),
14 dfs).fillna(nan_value)
15