Filtering based on two date columns in pandas

  datetime, pandas, python

I’m trying to filter out all rows that hold wage data that were earned before the end date of a training. So basically I only want wages with a wage period greater than or equal to the end date. When I run the python similar to below it is removing too many fields. I’m confused why this isn’t working

df = df[df['wage period']>= df['end date']]
participant end date wage period wage
Joe 1/1/2021 10/1/2020 $100
Bob 1/1/2020 7/1/2020 $150
Jess 10/1/2020 4/1/2020 $100
Bob 1/1/2020 1/1/2020 $200
Bob 1/1/2020 10/1/2019 $120

Source: Python Questions

LEAVE A COMMENT