0
I have a data frame with multiple columns. I need to filter based on two if the end of the string is the same as the other. p. example:
Item 1 Item 2 Item 3
carro do joão quitado casa do joão
carro do josé quitado casa do antonio
carro do thiago quitado casa do thiago
I need to pick up only the lines where the owners are the same in Item 1 and Item 3
I tried this way, but it only returns a list [John, John], I can’t think of alternatives.
teste = []
for row in dados.iterrows():
teste += dados['Item 1'].str.split('do ')[1][1] == dados['Item 3'].str.split('do ')[1][1]