An attempt to set the col 'X' value by slicing to multindex, as well as taking into account the conditional value of the "Z" column. I can set the col 'X' value pretty easily, but I'm stuck trying to figure out the conditional.
import pandas as pd
FOOBAR = (['foo','foo','foo','foo','bar','bar','bar','bar'])
NUM1 = ([5,5,6,6,8,8,5,5])
NUM2 = ([1,1,2,2,3,3,1,1])
NUM3 = ([1001,1002,1002,1002,1003,1004,1004,1005])
index = pd.MultiIndex.from_arrays([FOOBAR,NUM1,NUM2,NUM3],
names=['iFOOBAR','iNUM1','iNUM2','iNUM3'])
df = pd.DataFrame({'X': [ 0, 1, 2, 3, 4, 5, 6, 7],
'Y': [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'],
'Z': [ 1, 2, 2, 4, 5, 6, 7, 7],
'FL': [0.1,0.1,0.2,0.2,0.4,0.4,0.1,0.1]
}, index=index)
df.sortlevel(inplace=True)
idx = pd.IndexSlice
newdf = df.loc[idx['foo',5,1,:], idx['X']] = 999