Difference between tables, criteria

0

I have two tables as follows: I want to get the data that is in the left table and that is not in the right one. As the two tables have a common field, CPF, I want to generate another table only with the CPFs that are in the table on the left but not on the right.

asked by anonymous 24.10.2018 / 20:41

2 answers

0

Well, I did so: I named the left-hand dataframe as "newPas" and the right-hand one as "newFolt", and created the newResult variable, with the result of the difference of the two. It looks like this: newResult = newPas - newSheet. When I ran this command, I had the following result. Apparently, what is not like NAN is just the value of difference (which is not in one worksheet but is in the other). I've been checking it, just to be sure and what appears below that is not NAN does not really figure in one of the tables. That's what I want, but can anyone explain why?

0   NaN NaN NaN NaN NaN NaN
1   NaN NaN NaN NaN NaN NaN
2   3.145070e+10    NaN NaN NaN NaN NaN
3   NaN NaN NaN NaN NaN NaN
4   NaN NaN NaN NaN NaN NaN
5   NaN NaN NaN NaN NaN NaN
6   6.819145e+10    NaN NaN NaN NaN NaN
7   NaN NaN NaN NaN NaN NaN
...
    
25.10.2018 / 04:57
0

I got what I wanted with this solution that I quoted in the link. As I wanted it to return the left table that is not on the right, I used current.where (~ current ['CPF']. Isin (next ['CPF']).

Thank you.

    
25.10.2018 / 17:21