我正在尝试使用以下格式的 OHLC 数据加载 csv 文件。
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,,,,
我尝试了以下加载数据的方法。
df = read_csv('500008.csv', parse_dates=[0,1,2], usecols=range(6),
header=None, index_col=0)
但现在我想命名要命名的列。所以,我试过了,
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())
但这没有说,
IndexError: list index out of range
有人可以指出我做错了什么吗?