Difference between tables, criteria

Asked

Viewed 65 times

0

I have two tables like the following:I want to get the data that are in the Table on the left and that are not in the right. Since 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 that are not in the table on the right.

Tabela Folha de Pagamento trtreterter Tabela Plano de Saude

  • Perhaps it would be easier to understand if you put an example of the table that you want to get as a result based on these images, because as it is described it is confusing. Worth seeing this: https://answall.com/tour

  • I don’t understand what the question has to do with [tag:pandas] (python library), could you explain the question’s connection to this? Whether, using pandas, to obtain this data?

  • How do you not understand? I know the pandas does it very well, extracting the difference between the tables; I’ve seen it on youtube video and not finding it

  • Well, I did so: I named the left dataframe as "newPas" and the right as "newFolla", and created the newResult variable, with the result of the difference between the two. It looked like this: newResulted = newPas - newFolla. When running this command, I got the following result:

2 answers

0

Well, I did so: I named the left dataframe as "newPas" and the right as "newFolla", and created the newResult variable, with the result of the difference between the two. It looked like this: newResulted = newPas - newFolle. Running this command gave the following result. Apparently, what is not as NAN is precisely the value of the difference (what is not in one spreadsheet, but is in the other). I was checking, just to be sure and what appears below that is not NAN really not in one of the tables. That’s exactly what I want, but can someone explain to me 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
...
  • My need is exactly that of this guy; I will try to do what he did and return if it worked: https://answall.com/questions/130338/comparar-campos-em-dois-conjuos-datas?rq=1

0

I got what I wanted with this solution I mentioned on the link. As I wanted q me return the table of the left q is not on the right, I used current.Where(~current['Favored CPF'].isin(next['Favored CPF'])). Count()

Grateful.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.