def make_axis_dummies(frame, axis='<STR_LIT>', transform=None):
numbers = {'<STR_LIT>': <NUM_LIT:0>, '<STR_LIT>': <NUM_LIT:1>}<EOL>num = numbers.get(axis, axis)<EOL>items = frame.index.levels[num]<EOL>codes = frame.index.codes[num]<EOL>if transform is not None:<EOL><INDENT>mapped_items = items.map(transform)<EOL>codes, items = _factorize_from_iterable(mapped_items.take(codes))<EOL><DEDENT>values = np.eye(len(items), dtype=float)<EOL>values = values.take(codes, axis=<NUM_LIT:0>)<EOL>return DataFrame(values, columns=items, index=frame.index)<EOL>
Construct 1-0 dummy variables corresponding to designated axis
labels

Parameters
----------
frame : DataFrame
axis : {'major', 'minor'}, default 'minor'
transform : function, default None
    Function to apply to axis labels first. For example, to
    get "day of week" dummies in a time series regression
    you might call::

        make_axis_dummies(panel, axis='major',
                          transform=lambda d: d.weekday())
Returns
-------
dummies : DataFrame
    Column names taken from chosen axis