lundi 30 mars 2020

Changing dates in a dataframe based on the time of day?

I am working on a project that defines the time of day as 7am to 7 am rather than the traditional Midnight to Midnight. I need some help changing the dates in this dataframe to match our definition of day. For example, if this dataframe says 3:54am on December 21st, I need the date to change to December 20th. However, if it says 8:59PM then the date would remain identical to what is already in the dataset.

In simpler terms, I need to change the date for all times that fall between Midnight and 7AM. Is an Ifelse statement the best way to get at this?

Sorry for the confusing language but I couldn't think of a better way of phrasing what I'm getting at with this idea.

enter image description here

Aucun commentaire:

Enregistrer un commentaire