i am trying to merge(Left
) two tables but i end up getting a output with lots of duplicate rows
and below is the code that i have used so far
**file1 table**
TableA Desired output
date volume Key key1 NR/HL date Volume NR/HL
jan 100 a a 10 jan 100 10
jan 200 b b 20 jan 200 10
feb 300 a feb 300 20
feb 400 b feb 400 20
TableA=TableA.merge(TableB,left_on="Key",right_on="Key1",how="left")
TableA.drop_duplicates("Key",keep="first")
TableB
contains duplicates onKey1
? Otherwise, you don't even need to dodrop_duplicates
.TableB Key1
the only duplicates we have is inTableA
but will be unique with Month added.