get first n rows and columns of dataframe pandas code example Example: print last n rows of dataframe df1.tail(n)