Home > other >  For a list of index in the Dataframe cannot be an assignment
For a list of index in the Dataframe cannot be an assignment

Time:09-25

V3.5.3 version of PYTHON

Jupyter notebook type:
Df=pd DataFrame (np) random) randint (0100, size=(6, 6)), the index=list (" ABCDEF "), the columns=pd. MultiIndex. From_product ([[' Python ', 'En', 'Math'], [' interim '[' final']]]])
Df
Error: TypeError: unhashable type: 'list'

Checked the list types cannot hash, how do I set the row index to list types? Also, why others V3.6.5 version of PYTHON is not an error?

CodePudding user response:

 
Df=pd DataFrame (np) random) randint (0100, size=(6, 6)), the index=list (" ABCDEF "), the columns=pd. MultiIndex. From_product ([[' Python ', 'En', 'Math'], [' interim ', 'final']]))


Should be like this, you are in the final added brackets on both sides

CodePudding user response:

reference 1/f, ice wind of reply:
 
Df=pd DataFrame (np) random) randint (0100, size=(6, 6)), the index=list (" ABCDEF "), the columns=pd. MultiIndex. From_product ([[' Python ', 'En', 'Math'], [' interim ', 'final']]))


On both sides should be like this, you are in the final with square brackets
understand, again is a low-level error
  • Related