pandas merge dataframes from a list

Solutions on MaxInterview for pandas merge dataframes from a list by the best coders in the world

showing results for - "pandas merge dataframes from a list"
Facundo
21 Aug 2016
1def merge_dfs_from_list(df_list):
2    """Function to merge all dataframes from a list.
3    :param df_list: List of dataframes.
4    :type df_list: list
5    :return: A dataframe with all dataframes merged.
6    :rtype: pandas.DataFrame
7    """
8    final_df = df_list[0]
9    for i in range(1, len(df_list)):
10        final_df = final_df.merge(df_list[i])
11    return final_df