Reputation: 11
For a dataframe like the one below, I want to add one day to the date only in the 0:00 time zone. Is there any way to do it?
df.head(50)
Upvotes: 1
Views: 48
Reputation: 113988
# create a mask for all entries with midnight as their time
row_mask = (df['timezone'].dt.hour == 0) & (df['timezone'].dt.minute == 0)
#now apply it
df.loc[row_mask,'timezone'] = df[row_mask]['timezone'] + datetime.timedelta(days=1)
Upvotes: 1