0

I have a dataframe which looks as follows:

   colA  colB

0    2    1
1    4    2
2    3    7
3    8    5
4    7    2

I have two datasets one with customer code and other information and the other with addresses plus related customer code.

I did a merge with the two bases and now I want to return the lines where the values ​​in the columns are the same, but I'm not able to do it.

Can someone help me?

Thanks

LpCoutinho
  • 37
  • 4
  • 1
    this is an inner join `pd.merge(table_a,table_b,left_on=['ColA'],right_on=['ColB'],how='inner')` will return matching rows. – Umar.H Nov 23 '20 at 16:00
  • 1
    Does this answer your question? [Pandas Merging 101](https://stackoverflow.com/questions/53645882/pandas-merging-101) – Umar.H Nov 23 '20 at 16:00

1 Answers1

0

you can try :

dfs=df.loc[df['colA']==df['colB']]
NHL
  • 277
  • 1
  • 6