pandas select last 3 columns code example Example 1: how to select all but last columns in python df.iloc[:,:-1] Example 2: print last n rows of dataframe df1.tail(n)