How to slice a Pandas Data Frame by position? How to slice a Pandas Data Frame by position? pandas pandas

How to slice a Pandas Data Frame by position?


You can also do as a convenience:

df[:10]


df.ix[10,:] gives you all the columns from the 10th row. In your case you want everything up to the 10th row which is df.ix[:9,:]. Note that the right end of the slice range is inclusive: http://pandas.sourceforge.net/gotchas.html#endpoints-are-inclusive