我有以下输入文件:
2012,10,3,AAPL,BUY,200
2012,12,5,AAPL,SELL,200
如何将其读入带有以下列的熊猫数据框中:
index: default int range # 0
column1: datetime(2012,10,3,16) # 2012-10-03 16:00
column2: string # AAPL
column3: string # BUY
column4: integer # 200
例子:
0 2012-10-03 16:00 AAPL BUY 200
1 2012-12-05 16:00 AAPL SELL 200
尝试过(熊猫 0.7):
In[2]: pandas.io.parsers.read_csv("input.csv", parse_dates=[[0,1,2]], header=None)
Out[2]:
X.1 X.2 X.3 X.4 X.5 X.6
0 2012 10 3 AAPL BUY 200
1 2012 12 5 AAPL SELL 200