1
我想將兩列索引組合起來,同時使用pandas
dataframe
。我使用下面的代碼可以這樣做:在數據透視表中使用多個列進行索引
ConceptTemp = Concept.pivot(index=['memberid','testscoreid'], columns='questionid', values='correct')
這給了我以下錯誤:
ValueError: Wrong number of items passed 1532, placement implies 2
1532是排在我dataframe
數量。我不能只在memberid
或testscoreid
,因爲我將重複questionid
值。索引列必須是testscoreid
和memberid
的組合。
有沒有人有關於如何完成這個任務的指針?