Use df[-20:] for getting the last 20 lines from a DataFrame.
If you want to have the date 20 days ago, use pd.Timedelta(-19, unit='d') + pd.datetime.today().date().
In [1]: index = pd.date_range(start=(pd.Timedelta(-30, unit='d')+pd.datetime.today().date()), periods=31)
In [2]: df = pd.DataFrame(np.random.rand(31, 4), index=index, columns=['O', 'H', 'L', 'C'])
In [3]: df = df.reset_index().rename(columns={'index': 'Date'})
In [4]: df
Out[4]:
Date O H L C
0 2017-08-28 0.616856 0.518961 0.378005 0.716371
1 2017-08-29 0.300977 0.652217 0.713013 0.842369
2 2017-08-30 0.875668 0.232998 0.566047 0.969647
3 2017-08-31 0.273934 0.086575 0.386617 0.390749
4 2017-09-01 0.667561 0.336419 0.648809 0.619215
5 2017-09-02 0.988234 0.563675 0.402908 0.671333
6 2017-09-03 0.111710 0.549302 0.321546 0.201828
7 2017-09-04 0.469041 0.736152 0.345069 0.336593
8 2017-09-05 0.674844 0.276839 0.350289 0.862777
9 2017-09-06 0.128124 0.968918 0.713846 0.415061
10 2017-09-07 0.920488 0.252980 0.573531 0.270999
11 2017-09-08 0.113368 0.781649 0.190273 0.758834
12 2017-09-09 0.414453 0.545572 0.761805 0.586717
13 2017-09-10 0.348459 0.830177 0.779591 0.783887
14 2017-09-11 0.571877 0.230465 0.262744 0.360188
15 2017-09-12 0.844286 0.821388 0.312319 0.473672
16 2017-09-13 0.605548 0.570590 0.457141 0.882498
17 2017-09-14 0.242154 0.066617 0.028913 0.969698
18 2017-09-15 0.725521 0.742362 0.904866 0.890942
19 2017-09-16 0.460858 0.749581 0.429131 0.723394
20 2017-09-17 0.767445 0.452113 0.906294 0.978368
21 2017-09-18 0.342970 0.702579 0.029031 0.743489
22 2017-09-19 0.221478 0.339948 0.403478 0.349097
23 2017-09-20 0.147785 0.633542 0.692545 0.194496
24 2017-09-21 0.656189 0.419257 0.099094 0.708530
25 2017-09-22 0.329901 0.087101 0.683207 0.558431
26 2017-09-23 0.902550 0.155262 0.304506 0.756210
27 2017-09-24 0.072132 0.045242 0.058175 0.755649
28 2017-09-25 0.149873 0.340870 0.198454 0.725051
29 2017-09-26 0.972721 0.505842 0.886602 0.231916
30 2017-09-27 0.511109 0.990975 0.330336 0.898291
In [5]: df[-20:]
Out[5]:
Date O H L C
11 2017-09-08 0.113368 0.781649 0.190273 0.758834
12 2017-09-09 0.414453 0.545572 0.761805 0.586717
13 2017-09-10 0.348459 0.830177 0.779591 0.783887
14 2017-09-11 0.571877 0.230465 0.262744 0.360188
15 2017-09-12 0.844286 0.821388 0.312319 0.473672
16 2017-09-13 0.605548 0.570590 0.457141 0.882498
17 2017-09-14 0.242154 0.066617 0.028913 0.969698
18 2017-09-15 0.725521 0.742362 0.904866 0.890942
19 2017-09-16 0.460858 0.749581 0.429131 0.723394
20 2017-09-17 0.767445 0.452113 0.906294 0.978368
21 2017-09-18 0.342970 0.702579 0.029031 0.743489
22 2017-09-19 0.221478 0.339948 0.403478 0.349097
23 2017-09-20 0.147785 0.633542 0.692545 0.194496
24 2017-09-21 0.656189 0.419257 0.099094 0.708530
25 2017-09-22 0.329901 0.087101 0.683207 0.558431
26 2017-09-23 0.902550 0.155262 0.304506 0.756210
27 2017-09-24 0.072132 0.045242 0.058175 0.755649
28 2017-09-25 0.149873 0.340870 0.198454 0.725051
29 2017-09-26 0.972721 0.505842 0.886602 0.231916
30 2017-09-27 0.511109 0.990975 0.330336 0.898291
In [6]: df[df.Date.isin(pd.date_range(pd.Timedelta(-19, unit='d')+pd.datetime.today().date(), periods=20))]
Out[6]:
Date O H L C
11 2017-09-08 0.113368 0.781649 0.190273 0.758834
12 2017-09-09 0.414453 0.545572 0.761805 0.586717
13 2017-09-10 0.348459 0.830177 0.779591 0.783887
14 2017-09-11 0.571877 0.230465 0.262744 0.360188
15 2017-09-12 0.844286 0.821388 0.312319 0.473672
16 2017-09-13 0.605548 0.570590 0.457141 0.882498
17 2017-09-14 0.242154 0.066617 0.028913 0.969698
18 2017-09-15 0.725521 0.742362 0.904866 0.890942
19 2017-09-16 0.460858 0.749581 0.429131 0.723394
20 2017-09-17 0.767445 0.452113 0.906294 0.978368
21 2017-09-18 0.342970 0.702579 0.029031 0.743489
22 2017-09-19 0.221478 0.339948 0.403478 0.349097
23 2017-09-20 0.147785 0.633542 0.692545 0.194496
24 2017-09-21 0.656189 0.419257 0.099094 0.708530
25 2017-09-22 0.329901 0.087101 0.683207 0.558431
26 2017-09-23 0.902550 0.155262 0.304506 0.756210
27 2017-09-24 0.072132 0.045242 0.058175 0.755649
28 2017-09-25 0.149873 0.340870 0.198454 0.725051
29 2017-09-26 0.972721 0.505842 0.886602 0.231916
30 2017-09-27 0.511109 0.990975 0.330336 0.898291