0

I have dataframe [df] as shown below

df_final['endDate'] = df_final['endDate'].dt.strftime("%Y-%m-%d")
df_final['startDate'] = df_final['startDate'].dt.strftime("%Y-%m-%d")
df_final[['linkedShipments','endDate','insertDate']]

Input

linkedShipments endDate       insertDate
    1121006109  2021-09-20  2021-10-15
    1121006109  2021-10-15  2021-10-15
    1121011944  2021-10-20  2021-10-15
    1121011944  2021-10-15  2021-10-16
    1121012852  2021-09-20  2021-10-15
    1121011967  2021-10-20  2021-10-17
    1121011968  2021-10-17  2021-10-17
    1121011969  2021-10-27  2021-10-17
    1121011963  2021-10-28  2021-10-16

I want to select rows which have endDate greater than or equal to (>=) insertDate

Expected Output

linkedShipments endDate      insertDate
    1121006109  2021-10-15  2021-10-15
    1121011944  2021-10-20  2021-10-15
    1121011967  2021-10-20  2021-10-17
    1121011968  2021-10-17  2021-10-17
    1121011969  2021-10-27  2021-10-17
    1121011963  2021-10-28  2021-10-16

How can this be done in pandas?

0 Answers0