I have a table:
And I would like to slice the first three columns, how can I do this?
I've looked at this other post: Finding top N columns for each row in data frame, but that is overkill for me.
I've tried:
df1 = df.iloc[:,0:3]
But this gives the error: IndexingError: Too many indexers
EDIT:
More detailed code with the added ix
cols = [col for col in df.columns if col != 'stream']
candidates = df.loc[url,cols]
dfSorted = candidates.sort_values(ascending=False)
big_three = dfSorted.ix[:,0:3]