我有一个dataframe,我试图只获取列的一个子集,然后重命名这些列。你知道吗
req_cols = ['targetName','suiteName','configName','testName','actualResult_1','actualResult_2','explanation_1']
df = df[req_cols].rename(columns={'targetName':'tgt', 'suiteName':'suite', 'configName':'config', 'testName':'test', 'actualResult_2':'iresult', 'actualResult_1':'gresult', 'explanation_1':'explanation'})
我得到这个错误。你知道吗
raise KeyError('%s not in index' % objarr[mask])
KeyError: "['targetName' 'suiteName' 'configName' 'testName' 'actualResult_1'\n 'actualResult_2' 'explanation_1'] not in index"
为什么这个随机换行符出现在这个列列表中?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐