我有一个使用pandas的简单函数:
def get_data(filename):
'''function to read the data form the input csv file to use in the analysis'''
with open(filename, 'r') as f:
reader = pd.read_csv(f, sep=',', usecols=('candidate',' final track' ,' status'))
return reader
然而,当我打印阅读器时,我得到的是我指定的列右侧的两列。
为什么会这样?我该如何纠正呢? 我是熊猫的新手,很抱歉明显的错误
编辑:
我的csv文件的第一行是:
候选,超前滞后,强度,宽度,边缘轨迹,轨迹1,轨迹2,边缘轨迹计数,轨迹1计数,轨迹2计数,最终轨迹,状态,轨迹1可用,轨迹2可用,边缘与轨迹1相同,边缘相同轨道2,有效轨道