Setting values with multiindex in pandas
There are already a couple of questions on SO relating to this, most notably this one , however none of the answers seem to work for me and quite a few links to docs (especially on lexsorting) are broken, so I'll ask another one. I'm trying do to something (seemingly) very simple. Consider the following MultiIndexed Dataframe: import pandas as pd; import random arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'], ['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']] tuples = list(zip(*arrays)) index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second']) df = pd