def make_axis_dummies(frame, axis='minor', transform=None):
 numbers = {'major': 0, 'minor': 1}
 num = numbers.get(axis, axis)
 items = frame.index.levels[num]
 labels = frame.index.labels[num]
 if (transform is not None):
  mapped_items = items.map(transform)
  (labels, items) = _factorize_from_iterable(mapped_items.take(labels))
 values = np.eye(len(items), dtype=float)
 values = values.take(labels, axis=0)
 return DataFrame(values, columns=items, index=frame.index)

def make_axis_dummies ( frame , axis = 'minor' , transform = None ) : numbers = { 'major' : 0 , 'minor' : 1 } num = numbers . get ( axis , axis ) items = frame . index . levels [ num ] labels = frame . index . labels [ num ] if ( transform is not None ) : mapped_items = items . map ( transform ) ( labels , items ) = _factorize_from_iterable ( mapped_items . take ( labels ) ) values = np . eye ( len ( items ) , dtype = float ) values = values . take ( labels , axis = 0 ) return DataFrame ( values , columns = items , index = frame . index )
construct 1-0 dummy variables corresponding to designated axis labels parameters frame : dataframe axis : {major .