Date Open High Low Close Volume
2022-08-08 09:15:00 17397.39 17443.70 17359.75 17411.06 0
2022-08-10 13:15:00 17508.28 17532.00 17479.55 17510.24 0
2022-08-12 09:15:00 17651.81 17680.70 17597.85 17654.14 0
2022-08-18 09:15:00 17934.37 17954.65 17863.45 17914.30 0
I have this dataframe . I have to drop the rows when time= 9:15
CodePudding user response:
Use ~
operator to negate the conditions:
df.Date = pd.to_datetime(df.Date)
df[~((df.Date.dt.hour == 9) & (df.Date.dt.minute == 15))]