Categories
Python Answers

How to select multiple columns in a Python Pandas dataframe?

Spread the love

To select multiple columns in a Python Pandas dataframe, we can use df.loc.

For instance, we write

df.loc[:, 'C':'E']

to select all columns between 'C' and 'E' inclusive.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *