Key error when selecting columns in pandas dataframe after read_csv

后端 未结 3 2119
一向
一向 2020-12-01 10:49

I\'m trying to read in a CSV file into a pandas dataframe and select a column, but keep getting a key error.

The file reads in successfully and I can view the datafr

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 11:20

    if you need to select multiple columns from dataframe use 2 pairs of square brackets eg.

    df[["product_id","customer_id","store_id"]]
    

提交回复
热议问题