Posts

Showing posts with the label merge

Merge, join, and concatenate in Pandas

Merge, Join, Concat in Pandas First thing, go skim the official Pandas docs . It is pretty straightforward instructions on how to perform merge, join, concat using pandas. It has everything you need to know, but it is written very dryly and covers a lot of cases I rarely come across in my day to day, so I'll try to summarize quickly. I'll use their DataFrame in my notes below. df1 = pd.DataFrame({'A': ['A0', 'A1', 'A2', 'A3'],                     'B': ['B0', 'B1', 'B2', 'B3'],                     'C': ['C0', 'C1', 'C2', 'C3'],                     'D': ['D0', 'D1', 'D2', 'D3']},                     index=[0, 1, 2, 3])       df2 = pd.DataFrame({'A': ['A4', 'A5', 'A6', 'A7'],                     'B': ['B4', 'B5', '...