[python] Extract first and last row of a dataframe in pandas