Skip to content Skip to sidebar Skip to footer

Trying To Get The Time Delta Between Two Date Columns In A Dataframe, Where One Column Can Possibly Be "nat"

I am trying to get the difference in days between two dates pulled from a SQL database. One is the start date, the other is a completed date. The completed date can and is, in this

Solution 1:

So, you first have to check if any of the dates are NaT. If not, you can calculate by:

df.DELTA = (df['FINAL_DATE'] -  df['START_DATE']).days

Post a Comment for "Trying To Get The Time Delta Between Two Date Columns In A Dataframe, Where One Column Can Possibly Be "nat""