Pandas: Why are double brackets needed to select column after boolean indexing

前端 未结 4 1123
南笙
南笙 2021-01-29 20:08

For a df table like below,

   A B C D
0  0 1 1 1
1  2 3 5 7
3  3 1 2 8

why are the double brackets needed for selecting specific columns after

4条回答
  •  别那么骄傲
    2021-01-29 20:57

    Adding to previous responses, you could also use df.iloc accessor if you need to select index positions. It's also making the code more reproducible, which is nice.

提交回复
热议问题