pandas dataframe indexing by columns

Viewed 899

I would like to choose a dataframe by df[:,(1,5:)] i.e. all rows and column number 1 and columns 5 to the end.

I have tried:

df.loc[1:3,('col_1','col_5':)]

Any easy way to do it by column number or column name (both)?

2 Answers
Related