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
  • 11,440
  • 3
  • 12
  • 27
RedTabby
  • 1
  • 1

2 Answers2

0

Try

df['Late_Not_Late'] = np.where(df["Forecast_Date"] > df["Completed_Date"],True,False)
azro
  • 47,041
  • 7
  • 30
  • 65
0

I think all you need is

df['Late_not_late'] = df.Forecast_Date > df.Completed_Date
azro
  • 47,041
  • 7
  • 30
  • 65
JoeCondron
  • 7,936
  • 2
  • 24
  • 27