The Python Oracle

Setting column to true/false based on comparison of two other columns in pandas?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Magical Minnie Puzzles

--

Chapters
00:00 Question
00:59 Accepted answer (Score 5)
01:17 Thank you

--

Full question
https://stackoverflow.com/questions/6448...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #pandas

#avk47



ACCEPTED ANSWER

Score 6


Basically, below line will check each row and boolean result will be assigned into the new column of provided as:

 df['provided'] = df['value'] == df['predicted']