Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
With pandasPandas,
wit column names
dataframe[['column1','column2']]
to select by iloc and specific columns with index number:
dataframe.iloc[:,[1,2]]
with loc column names can be used like
dataframe.loc[:,['column1','column2']]
With pandas,
With Pandas,
hope it helps !
withto select by iloc, column and specific columns with index can be used likenumber:
dataframe[dataframe.iloc[:,[1,2]]
edited to fix .loc accessor, the fix for which was < 6 characters
with iloc, column index can be used like
dataframe[:,[1,2]]