Given any pandas dataframe. I want to select columns A, B and F:Z
I have tried to do it df.loc[:, ['A','B','F':'Z']]
but it didn't work.
Please advise how to do this.
Given any pandas dataframe. I want to select columns A, B and F:Z
I have tried to do it df.loc[:, ['A','B','F':'Z']]
but it didn't work.
Please advise how to do this.
We can do two slice then combine
df.loc[:, ['A','B']].join(df.loc[:,'F':'Z'])
And side solution change all name to position then we can do
df.iloc[:,np.r_[1,2,5:999]]