how to show first and last n rows in pandas code example Example: print last n rows of dataframe df1.tail(n)