Noobie Noobie - 1 year ago 52
Python Question

how to slice a dataframe from the end to the beginning?

I am slicing a dataframe like this:

for i in xrange(0,len(df),100000):
print("slice %d!!!!" % i)
slice= df.iloc[i:(i+100000)]

I would like now to get
slices from the end to the beginning of the df (without necessarily sorting my dataframe).

How can I do that?


Answer Source

Simply use tail: