Кто-нибудь сталкивался с похожим на мой случай? Я пытаюсь преобразовать значения даты и времени из pd.read_csv. Но я получаю сообщение об ошибке.
python 3.6.3
панды 0.25.3
Данные из CSV:
date, recs, co2v, usg
2018.05.16 9:00, 85.774, 85.777, 85.697
2018.05.16 10:00, 85.712, 85.789, 85.675
2018.05.16 11:00, 85.787, 85.811, 85.657
КОД:
20: format = '%Y.%m.%d %H:%S'
21: df['date'] = pd.to_datetime(df['date'], format=format, errors='raise')
22: print(df.info())
23: print(df.head())
Ошибка:
Traceback (most recent call last):
File "test1.py", line 21, in
df['date'] = pd.to_datetime(df['date'], format=format, errors='raise')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/frame.py", line 2973, in __getitem__
return self._get_item_cache(key)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/generic.py", line 3270, in _get_item_cache
values = self._data.get(item)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/internals/managers.py", line 960, in get
return self.iget(loc)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/internals/managers.py", line 977, in iget
block = self.blocks[self._blknos[i]]
TypeError: only integer scalar arrays can be converted to a scalar index