简体   繁体   中英

How to take a subset of the columns of a pandas data frame?

I have got a pandas data frame with multiple columns and a list with column indices (0, 1, ..., n) that index a subset of the columns of the data frame. How can I create a new data frame with exactly this subset of columns?

The answer to your question can be found in the pandas documentation:

How do I select a subset of DataFrame

The article displays many different ways to do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM