I would like to combine two columns for index while pivoting a pandas dataframe. I'm using the following code to do so:
ConceptTemp = Concept.pivot(index=['memberid','testscoreid'], columns='questionid', values='correct')
this gives me the following error:
ValueError: Wrong number of items passed 1532, placement implies 2
1532 is the number of rows in my dataframe. I can't pivot only on memberid or on testscoreid as I'll have duplicate questionid values. The index column has to be a combination of testscoreid AND memberid.
Would anyone have any pointers on how to get this done?