Pandas every nth row

Dataframe.resample() works only with timeseries data. I cannot find a way of getting every nth row from non-timeseries data. What is the best method?

I'd use iloc, which takes a row/column slice, both based on integer position and following normal python syntax.

    df.iloc[::5, :]

From: stackoverflow.com/q/25055712

Back to homepage or read more recommendations: