Merging Two Columns Which Don't Overlap And Create New Columns July 28, 2023 Post a Comment import pandas as pd df1 = pd.DataFrame([['2014', 'q2']], columns=('Year', 'Quarter')) df2 = pd.DataFrame([['2016', 'q1'], ['2015', 'q1']],Solution 1: You can use:df1.merge(df2, on=['Year', 'Quarter'], how='outer').dropna() Copyto get:YearQuarter02014 q212016 q122015 q1CopyYou can also look into pd.concat(). Share Post a Comment for "Merging Two Columns Which Don't Overlap And Create New Columns"
Post a Comment for "Merging Two Columns Which Don't Overlap And Create New Columns"