mtu,dap
06.01.2015 00:00 - 06.01.2015 01:00,36.90
I am trying to work the comma delimited data from the picture above into pandas for further analysis with the following bit of code:
import pandas as pd
DAP = pd.read_csv('xx.csv',
index_col = 'mtu',
sep = ',',
encoding="utf-8-sig")
#DAP = DAP.set_index('mtu')
date_time = DAP['mtu']
Hourly_DAP = DAP['dap']
However it keep giving me the following error, with set_index enabled and with index_col, have tried other solutions that can be found online but none seem to solve this issue:
KeyError: 'mtu'
Would anyone be able to solve this issue?
I have updated the code according to the duplicate question to the following however now I get nameError that index is not defined. The answer to the duplicate question is very brief so cannot figure it out. The updated code is as follows, can any pick the mistake?:
import pandas as pd
DAP = pd.read_csv('xx.csv',
sep = ',',
encoding="utf-8-sig")
DAP = DAP.set_index('mtu','dap')
print(DAP.index)
index(['mtu', 'dap'], dtype='object', name='TweetID')