我有这段代码,我不明白为什么它不起作用:
folder_path = 'C:/Users/...' (all good here, I swear)
files_names = reading_csv_files(folder_path)[1]
dict_files = reading_csv_files(folder_path)[2]
### 'Diagnostic_Features.csv': useful: Feat-PD - 1670 patients.
DIAGFEAT=dict_files[files_names[1]]
SEL=['REC_ID', 'PATNO', 'EVENT_ID','INFODT',
'DFSTROKE', 'DFRSKFCT', 'DFPRESNT', 'DFRPROG', 'DFSTATIC', 'DFHEMPRK',
'DFAGESX', 'DFOTHCRS', 'DFRTREMP', 'DFRTREMA', 'DFPATREM',
'DFOTHTRM', 'DFRIGIDP', 'DFRIGIDA', 'DFAXRIG', 'DFUNIRIG',
'DFTONE', 'DFOTHRIG', 'DFBRADYP', 'DFBRADYA', 'DFAKINES',
'DFBRPLUS', 'DFOTHABR', 'DFPGDIST', 'DFGAIT', 'DFFREEZ',
'DFFALLS', 'DFOTHPG', 'DFPSYCH', 'DFCOGNIT', 'DFDYSTON',
'DFCHOREA', 'DFMYOCLO', 'DFOTHHYP', 'DFHEMTRO', 'DFPSHYPO',
'DFSEXDYS', 'DFURDYS', 'DFBWLDYS', 'DFOCULO', 'DFEYELID', 'DFNEURAB','DFRAPSPE', 'DFBULBAR','DFATYP']
DIAGFEAT_sel=DIAGFEAT[SEL]
但是这给了我以下错误:
File "C:\Python27\lib\site-packages\pandas\core\indexing.py", line 1112, in _convert_to_indexer
KeyError('%s not in index' % objarr[mask])
KeyError: "['DFSTROKE' 'DFRSKFCT' ...'DFATYP'] not in index"
我该如何解决?谢谢