index = [np.array(['foo', 'foo', 'qux']),np.array(['a', 'b', 'a'])]
data = np.random.randn(3, 2)
columns = ["X", "Y"]
df = pd.DataFrame(data, index=index, columns=columns)
df.index.names = ["Level0", "Level1"]
print dfX Y
Level0 Level1
foo a 0.418549 0.252685b -1.307099 0.202833
qux a 0.046095 -0.968976
New level
I want to take the index of df and create a new MultiIndex that now has an additional level.
new_level_name = "New level"
new_level_labels = ['p', 'q']
# new_multi-index
Desired MultiIndex
Level0 Level1 Level2
foo a p q b p q
qux a p q