'Apply function to each column, by group'

def transform_array(self, array, function, level=0, **kwargs):

    if (array.shape[0] != self.nobs):
        raise Exception('array    does    not    have    the    same    shape    as    index')
    dataframe = pd.DataFrame(array, index=self.index)
    return self.transform_dataframe(dataframe, function, level=level, **kwargs)
