PANDAS drop a range of rows from df
Use slice to select the part you want:
df[:-m]
If you want to remove some middle rows, you can use drop
:
df.drop(df.index[3:5])
This should work
df.head(len(df) - m)
an example where the range you want to drop is indexes between x and y which I have set to 0 and 10
selecting just the locations between 0 and 10 to see the rows to confirm before removing
x=0 # could change x and y to a start and end date
y=10
df.loc[x:y]
selecting the index
df.loc[x:y].index
so to remove selection from dataframe
df.drop(df.loc[x:y].index, inplace=True)