简体   繁体   中英

Pandas Dataframe, join two dt when columns are not equal

Assume I have two datatables, identical shape, say N rows and 2 columns. They have same columns names "One", "Two"

Call first table "left", then call second table "right".

How can I return a new datatable FROM table "Left", when value from two tables in column "One" are not equal ?

EX:

Table "Left"
One    Two
1       2
1       2
2       3
2       5
3       6


Table "Right"
One    Two
1       2
2       2
2       3
5       5
3       8


Output Table 
One    Two
1       2
2       5

Thank you!

Think you need this:

left[left.One.values != right.One.values]

# One   Two
#1  1     2
#3  2     5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM