I need to delete the rows of a dataframe in a certain period of time, in this case my index is time, but i can't
i try:
df.drop(df.loc['2021-01-27 00:34:00':'2021-03-12 20:43:00'])
but the code interprets that the second term is a column
CodePudding user response:
You can use query
here:
df.query("Fecha < '2021-01-27 00:34:00' | Fecha > '2021-03-12 20:43:00'")
CodePudding user response:
df.drop(df.loc["2017-01-02":"2017-01-05"].index)
Works.