I have a dataframe say :
A | B
1 a
2 b
3 c
4 d
and another one like :
A | G
1 Gate
and i want to combine the first dataframe with the other dataframe such that it shows :
A | B | G
1 a Gate
2 b
3 c
4 d
I have not been able to create the new column using pd.merge
and i am new to python/pandas. Any help would be appreciated.
Another condition i failed to mention was that the dataframe with one row can have multiple changes since it is in a loop and the variables keep changing.
So,
A | G
1 Gate
could be
A | H
2 Gate 2
or
A | F
4 gate 4
So the final output would say :
A | B | G | H | F |
1 a Gate
2 b Gate 2
3 c
4 d Gate 4
At the end of this loop i would like to write this output to an excel file using
pd.to_excel
.