How to select the last column of dataframe

后端 未结 7 784
北恋
北恋 2020-11-30 01:18

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

df[df.columns[len(df.columns)-1]]

which to m

7条回答
  •  悲哀的现实
    2020-11-30 02:19

    The question is: how to select the last column of a dataframe ? Appart @piRSquared, none answer the question.

    the simplest way to get a dataframe with the last column is:

    df.iloc[ :, -1:]
    

提交回复
热议问题