Pandas every nth row

The Solution to Pandas every nth row is


I'd use iloc, which takes a row/column slice, both based on integer position and following normal python syntax. If you want every 5th row:

df.iloc[::5, :]

~ Answered on 2014-07-31 11:25:16


Most Viewed Questions: