Reputation: 3729
I am trying to extract the 7th to 14th columns in a data frame. However
df[0:3]
only gives the 1st to 3rd rows.
Does anyone knows what should I do if I want to find out the columns?
I know how to do it with column names such as df['a']
but as the names are too many, I just want to type something like df[,7:14]
in R.
Thanks in advance.
Upvotes: 9
Views: 9249
Reputation: 3729
Looks that I found it....
By using iloc..
df.iloc[:,your_col_index]
Upvotes: 14