我收到ValueError:“浸入时间”不在列表中

时间:2019-09-23 04:58:41

标签: python pandas pandas-groupby

我的csv文件如下;

  Site,Tank ID,Product,Volume,Water Level,Temperature,Ullage,Dip Time
    abc,1,ADO,35302.00,0.00,19.10,14697.00,18/09/2019 07:54:54 a.m.
    xyz,2,ADBLU,1014.00,0.00,14.80,3985.00,18/09/2019 07:54:54 a.m.

我尝试使用熊猫处理它们。

def read_dipsfile(writer):
    atg_path = '/Users/ratha/PycharmProjects/data/dips'
    files = os.listdir(atg_path)
    df = pd.DataFrame()
    dateCol = ['Dip Time']
    for f in files:
        if(f.endswith('.CSV')):
            print (f)
            data = pd.read_csv(os.path.join(atg_path, f), delimiter=',', skiprows=[0], parse_dates=dateCol)

..

我收到以下错误;

File "/Users/ratha/PycharmProjects/LOADER/DataProcessor.py", line 64, in processFiles
    read_dipsfile(writer)
  File "/Users/ratha/PycharmProjects/LOADER/DataProcessor.py", line 51, in read_dipsfile
    data = pd.read_csv(os.path.join(atg_path, f), delimiter=',', skiprows=[0], parse_dates=dateCol)
....
      File "/Users/ratha/PycharmProjects/venv3bploader/lib/python3.6/site-packages/pandas/io/parsers.py", line 2027, in _set
        x = names.index(x)
    ValueError: 'Dip Time' is not in list

为什么呢,dip Time是我的列名之一?

0 个答案:

没有答案