Is it possible to use the .assign()
function/method to replace or create a column (with multiple levels) in a MultiIndexed column?
It is possible to create a column with a single level (level=0) but not with multiple levels.
For more details I have raised this question on Stack Overflow.
Comment From: jreback
you can simply directly index
df[('a', 1)] = ...
.assign
cannot support this syntax as its a function call, where a tuple is not a valid identifier.
I suppose you could update the doc-string of .assign
to mention that not-valid-identifier's are not valid.