I have two tables (data frames). 1. One that contains years and production. 2. Another that contains years and area. I want to merge these two and get results as shown in table 3. How to do this is python3 (preferably using pandas)?
Table1
Table2
Result table:
CodePudding user response:
IIUC use:
df = pd.concat([df1, df2]).T
CodePudding user response:
Try using this:
Dataframe df3
df3 = pd.merge(df1, df2, on='Years')