I generate a multiindex dataframe like this example
import pandas as pd
import numpy as np
iterables = [ ['co1', 'co2', 'co3', 'co4'], ['age','weight'] ]
multi = pd.MultiIndex.from_product(iterables, names= ["Spread", "attribute"])
df = pd.DataFrame(np.random.rand(80).reshape(10,8),index = range(0,10), columns = multi)
The columns each have a sublevel attribute called 'weight'
I need to generate a list or (preferably) Series that contains, for a given row, all the 'weight' sub-columns in that row. In the example picture, I'd want a Series that gave me 0.02, 0.46, 0.33, 0.47.
Can anyone suggest a nice way to do this? The solutions I've thought of are all gross, and I suspect I have an incomplete understanding of the indexing capabilities of pandas.
