Stack Exchange
Stack Overflow
Questions
Tags
Users
About
Stack Overflow
Public
Questions
Tags
Users
About
Pandas - drop row where two columns equal each other?
Asked
May 13 '20 at 16:43
Active
May 13 '20 at 16:43
Viewed
18 times
0
How can I drop a a row when the values in 2 of the columns are equal?
Many thanks.
python
pandas
asked May 13 '20 at 16:43
user2629628
161
1
3
11
Provide some examples with code
–
Kastakin
May 13 '20 at 16:47
Try this: `df = df[ df['col1'] != df['col2'] ]`
–
hacker315
May 13 '20 at 16:49
@hacker315 many thanks it worked(thought I had tried that. Did try this: df.drop_duplicates(subset=["col1","col2"]) but didn't work. Any ideas?
–
user2629628
May 13 '20 at 18:36
0 Answers
0