vendredi 23 mars 2018

Python: if statement between two date times

I want to loop over the rows of a dataframe that has a date time index. Within this loop I want to include an if function based on the time. Below an example of what I want:

N = len(df)

for i in range(1,N):
   if index is >= 11:00: #Start charging battery after 11:00 
      charge battery till full
   else:
      do not charge battery

How do I create an if function based on the time in date time index? The index is for half a year in steps of 15 minutes. So everyday it needs to start charging at 11:00.

Aucun commentaire:

Enregistrer un commentaire