Select specific CSV columns (Filtering) - Python/pandas

前端 未结 3 608
梦如初夏
梦如初夏 2020-12-31 07:02

I have a very large CSV File with 100 columns. In order to illustrate my problem I will use a very basic example.

Let\'s suppose that we have a CSV file.

3条回答
  •  臣服心动
    2020-12-31 07:14

    As Wai Yip Tung said, you can filter your dataframe while reading by specifying the name of the columns, for example:

    import pandas as pd
    data = pd.read_csv("ThisFile.csv")[['value','d']]
    

    This solved my problem.

提交回复
热议问题