I am trying to load a csv file with OHLC data in the following format.
In [49]: !head '500008.csv'
03 Jan 2000,12.85,13.11,12.74,13.11,976500,,,,
04 Jan 2000,13.54,13.60,12.56,13.33,2493000,,,,
05 Jan 2000,12.68,13.34,12.37,12.68,1680000,,,,
06 Jan 2000,12.60,13.30,12.27,12.34,2800500,,,,
07 Jan 2000,12.53,12.70,11.82,12.57,2763000,,,,
10 Jan 2000,13.58,13.58,13.58,13.58,13500,,,,
11 Jan 2000,14.66,14.66,13.40,13.47,1694220,,,,
12 Jan 2000,13.66,13.99,13.20,13.54,519164,,,,
13 Jan 2000,13.67,13.87,13.54,13.80,278400,,,,
14 Jan 2000,13.84,13.99,13.30,13.50,718814,,,,
I tried the following which loads the data.
df = read_csv('500008.csv', parse_dates=[0,1,2], usecols=range(6),
header=None, index_col=0)
But now I want to name the columns to be named. So, I tried,
df = read_csv('500008.csv', parse_dates=[0,1,2], usecols=range(6),
header=None, index_col=0, names='d o h l c v'.split())
but this fails saying,
IndexError: list index out of range
Can someone point out what I am doing wrong?