Nathan Miller Nathan Miller - 5 months ago 37
Python Question

How to select the last column of dataframe

I have done some searching for the answer to this question, but all I can figure out is this:


which to me seems unweildy, and un-pythonic (and slow?).

What is the easiest way to select the data for the last column in a pandas dataframe without specifying the name of the column?


Use iloc and select all rows (:) against the last column (-1):