Skip to content Skip to sidebar Skip to footer

Datetime64 Comparison In Dataframes

I am struggling with datetime64 comparisons in dataframes to update a column. lets say we have a dataframe 'df' with a 'date' column df.date.values[0] Out[128]: numpy.datetime64('2

Solution 1:

Have you tried something like:

flag = pd.Series(np.where(df.date == np.datetime64('2015-05-17'), True, False), index=df.index)

flag will be a series of True/False values which you use later.

Post a Comment for "Datetime64 Comparison In Dataframes"