I have df with columns 'Time' and 'Col1'. I would like to write a simple function that changes the values of 'Col1' between the time intervals from 'Time' column.
I don't know why the following code produces the following error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
val = 5
time1 = 200
time2 = 300
def reset_value(df, val, time1, time2):
df.loc[df['Time'] >= time1 and df['Time']<time2, 'Col1'] = val
return df