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.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.