I have a .csv file with three columns and many rows. I am trying to use pandas to read only the third column.
我有一个包含三列和多行的.csv文件。我正在尝试使用pandas来只读第三列。
right now I have:
现在我有:
import pandas as pd
pd.read_csv(r"C:\test.csv",usecols=(3))
1 个解决方案
#1
12
column indexing is zero based, pass 2
to read the third column:
列索引基于零,传递2以读取第三列:
pd.read_csv(r"C:\test.csv",usecols=[2])
#1
12
column indexing is zero based, pass 2
to read the third column:
列索引基于零,传递2以读取第三列:
pd.read_csv(r"C:\test.csv",usecols=[2])