A bit complicated to explain this one (see example table below for reference).
I have a dataframe with a 'Date Received' column (datetime)
I want to compare the 'Date Received' with the date in the Stage columns to see if it was on-time or late. The problem I have is that each document corresponds to a different stage, for example, file 26 might have a Stage 4 Date where as File 28 might be Stage 1.
How do I get Python to search for the correct stage column and then compare with date received?
Filename Date Received Stage 1 Expected Stage 2 Expected Stage 3 Expected Stage 4 Expected
File 1 01/01/2021 15/12/2020 NaN NaN NaN
File 2 01/01/2021 NaN 05/01/2021 NaN NaN