Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 22
    I just tried using this and it failed because reduce was replaced with functools.reduce So import functools functools.reduce(.......) Commented Jun 7, 2017 at 20:34
  • 5
    How will this solution work if I the names of the fields to join are different? For example, in three data frames I could have name1, name2 and name3 respectively. Commented Apr 10, 2018 at 10:16
  • 3
    Doesn't this mean that we have n-1 calls to the merge function? I guess in this case where the number of dataframes is small it doesn't matter, but I wonder if there's a more scalable solution. Commented Jun 21, 2018 at 20:09
  • 2
    This didn't quite work for my dfs with column multi indexes (it was injecting the 'on' as a column which worked for the first merge, but subsequent merges failed), instead I got it to work with: df = reduce(lambda left, right: left.join(right, how='outer', on='Date'), dfs) Commented Jan 31, 2019 at 7:25
  • 1
    +1 to ps0604. what if the join columns are different, does this work? should we go with pd.merge incase the join columns are different? thanks Commented May 21, 2020 at 7:48