get all but last column pandas code example Example 1: get last column pandas df.iloc[:,-1:] Example 2: how to select all but last columns in python df.iloc[:,:-1]