我得到的列名列表如下:featuresA = [str(col) + '_x' for col in group.index]
其中组是系列。我收到了10个列名的列表,如“Col1_x”、“Col2_x”等
现在我想把序列值读入数据帧对象:
^{pr2}$
错误消息显示:raise KeyError('%s not in index' % objarr[mask])
当我使用分组到帧(),结果为0。在
完整的代码如下所示:featuresA = [str(col) + '_x' for col in group.index]
featuresB = [str(col) + '_y' for col in match.iloc[[idx]].columns]
mergedrow = pd.DataFrame()
mergedrow[featuresA] = group[featuresA]
mergedrow[featuresB] = match.iloc[[idx]]
更新:
以下是整个错误消息:raise KeyError('%s not in index' % objarr[mask])
KeyError: "['airportResources.baggage_x' 'airportResources.arrivalTerminal_x'\n 'arrivalAirportFsCode_x' 'operationalTimes.scheduledGateArrival.dateLocal_x'\n 'schedule.flightType_x' 'schedule.serviceClasses_x' 'status_x'\n 'operationalTimes.actualDateTime_x'] not in index"