I have a list of several DataFrames in Python that I am attempting to merge. Currently, I am merging them like so:
import pandas as pd
from functools import reduce
DATAFRAMES = [DF1, DF2, . . . , DFN]
FINAL = reduce(lambda left,right: pd.merge(left, right, on = 'key_column_name',
how = 'outer'), DATAFRAMES)
This solution works well for the merging aspect, however, my question is whether this is the most efficient way to do this for some large N DataFrames.
Is there a way to optimize/alter this code or perhaps use a different library like dask for when I have several large dataframes that need to be merged?
Thanks!