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 pass in an array of column names to select.

For instance, we write

df1 = df[['a', 'b']]

to select columns 'a' and 'b' and return it.

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 *