0

I would like to know how to compare with another dataFrame.
Let's say df1 looks like following structure.

       Date       Time      X
0   2017-10-15  12:50:00    10
1   2017-10-15  12:51:00    15
2   2017-10-15  12:52:00    20
3   2017-10-15  12:53:00    26
4   2017-10-15  12:54:00    23
5   2017-10-15  12:55:00    45

And df2 looks like this:

       Date       Time      X
0   2017-10-15  12:50:00    10
1   2017-10-15  12:51:00    15
2   2017-10-15  12:52:00    20
3   2017-10-15  12:53:00    26
4   2017-10-15  12:54:00    23
5   2017-10-15  12:55:00    45
6   2017-10-15  12:56:00    123
7   2017-10-15  12:57:00    154
8   2017-10-15  12:58:00    112

I read these files with pandas. 'pd.read_csv'
I am expecting the result which is the differences between 2 dataframes.
and it should look like following image:

       Date       Time      X
6   2017-10-15  12:56:00    123
7   2017-10-15  12:57:00    154
8   2017-10-15  12:58:00    112

FYI, this is just an example. It has over 90,000 data in real.
What kind of function should I use to get above dataframe??
I am newbie in python, but I was Rstudio user. :)
I will really appreciate your comments!
Thanks for your help!!

Ilja Everilä
  • 50,538
  • 7
  • 126
  • 127
Dougie Hwang
  • 93
  • 1
  • 1
  • 9
  • With "difference", do you mean rows in `df2` that are not in `df1`? Because "difference" can also mean difference in values (e.g. `df1["X"] - df2["X"]`). If you mean the former, there's a similar question here: https://stackoverflow.com/questions/28901683/pandas-get-rows-which-are-not-in-other-dataframe – Plasma Aug 07 '18 at 07:23
  • I mean the former!! thanks! – Dougie Hwang Aug 07 '18 at 07:25

0 Answers0