I have pandas dataframe df1
:
STK_ID RPT_Date TClose sales discount
0 000568 20060331 3.69 5.975 NaN
1 000568 20060630 9.14 10.143 NaN
2 000568 20060930 9.49 13.854 NaN
3 000568 20061231 15.84 19.262 NaN
4 000568 20070331 17.00 6.803 NaN
5 000568 20070630 26.31 12.940 NaN
6 000568 20070930 39.12 19.977 NaN
7 000568 20071231 45.94 29.269 NaN
8 000568 20080331 38.75 12.668 NaN
9 000568 20080630 30.09 21.102 NaN
10 000568 20080930 26.00 30.769 NaN
I wanted to select the last 3 rows and tried df1.ix[-3:]
, but it returns all the rows. Why? How to get the last 3 rows of df1
? I'm using pandas 0.10.1.
Don't forget DataFrame.tail
! e.g. df1.tail(10)