I have df:
Voltage
01-02-2017 00:00 13.1
01-02-2017 00:01 13.2
01-02-2017 00:02 13.3
01-02-2017 00:03 14.1
01-02-2017 00:04 14.3
01-02-2017 00:04 13.5
I would like the time (hh:mm) of the first instance of when the value in the Voltage column >=14.0. There should only be one time value in column 'Time of Full Charge'.
Voltage Time of Full Charge
01-02-2017 00:00 13.1
01-02-2017 00:01 13.2
01-02-2017 00:02 13.3
01-02-2017 00:03 14.1 00:03
01-02-2017 00:04 14.3
01-02-2017 00:04 13.5
I am trying something along these lines, but cannot figure it out:
df.index = pd.to_datetime(df.index)
df.['Time of Full Charge'] = np.where(df.['Voltage'] >= 14.0), (df.index.hour:df.index.minute))