I am trying to read data from a csv file into a pandas dataframe, and access the first column \'Date\'
import pandas as pd
df_ticks=pd.read_csv(\'values.csv\
As mentioned by alko, it is probably extra character at the beginning of your file.
When using read_csv, you can specify encoding
to deal with encoding and heading character, known as BOM (Byte order mark)
df = pd.read_csv('values.csv', delimiter=',', encoding="utf-8-sig")
This question finds some echoes on Stackoverflow: Pandas seems to ignore first column name when reading tab-delimited data, gives KeyError
You most likely have an extra character at the beginning of your file, that is prepended to your first column name, 'Date'
. Simply Copy / Paste your output to a non-unicode console produces.
Index([u'?Date', u'Open', u'High', u'Low', u'Close', u'Volume'], dtype='object')