我读.csv文件到一个数据帧(CorpActionsDf),但是当我打印CorpActionsDf的脑子里,我看到我丢失的数据的第一行:缺少第一行从CSV
的头将该.cvs数据:
CorpActionsDf的BBG.XAMS.ASML.S 24/04/2015 0.7 Annual Regular Cash
BBG.XAMS.ASML.S 25/04/2014 0.61 Annual Regular Cash
BBG.XAMS.ASML.S 26/04/2013 0.53 Annual Regular Cash
BBG.XAMS.ASML.S 26/11/2012 9.18 None Return of Capital
BBG.XAMS.ASML.S 27/04/2012 0.46 Annual Regular Cash
头:
date factor_value reference factor
unique_id
BBG.XAMS.ASML.S 25/04/2014 0.61 Annual Regular Cash
BBG.XAMS.ASML.S 26/04/2013 0.53 Annual Regular Cash
BBG.XAMS.ASML.S 26/11/2012 9.18 None Return of Capital
BBG.XAMS.ASML.S 27/04/2012 0.46 Annual Regular Cash
BBG.XAMS.ASML.S 26/04/2011 0.40 Annual Regular Cash
正如你所看到的数据在CSV的第一行是从数据帧丢失。
BBG.XAMS.ASML.S 24/04/2015 0.7 Annual Regular Cash
我的代码如下:
def getCorpActionsData(rawStaticDataPath):
pattern = 'CorporateActions'+ '.csv'
staticPath = rawStaticDataPath
with open(staticPath+pattern,'rt') as f:
#staticDf=pd.read_csv(f,engine='c',header=0,index_col=0, parse_dates=True, infer_datetime_format=True,usecols=(0,3))
CorpActionsDf=pd.read_csv(f,engine='c',header=0,index_col=0, parse_dates=True, infer_datetime_format=True,names=['unique_id', 'date','factor_value','reference','factor'])
print('CorpActionsDf')
print(CorpActionsDf.head())
任何一个有一个想法,我缺少的是什么?
感谢