0

I have a forecast date column and a completed date column in a pandas dataframe. I want to add a column that shows if the completed date was greater than the forecast date, i.e. late/not late.

Beginner, so I've got this bit

Late_Not_Late = np.where(df["Forecast_Date"] > df("Completed_Date"], True, False) 

Am struggling with the other lines I need.

sophocles
  • 13,593
  • 3
  • 14
  • 33
RedTabby
  • 1
  • 1

2 Answers2

0

Try

df['Late_Not_Late'] = np.where(df["Forecast_Date"] > df["Completed_Date"],True,False)
azro
  • 53,056
  • 7
  • 34
  • 70
0

I think all you need is

df['Late_not_late'] = df.Forecast_Date > df.Completed_Date
azro
  • 53,056
  • 7
  • 34
  • 70
JoeCondron
  • 8,546
  • 3
  • 27
  • 28