def inverse_transform(self, X):
        """Inverse Transform: numpy ndarray(matrix) to dataframe with original columns"""
        non_cat = pd.DataFrame(X[:, :len(self.non_cat_columns_)],
                               columns=self.non_cat_columns_)
        cats = []
        for col, cat in self.cat_map_.items():
            slice_ = self.cat_blocks_[col]
            codes = X[:, slice_].argmax(1)
            series = pd.Series(pd.Categorical.from_codes(
                codes, cat.categories, ordered=cat.ordered
            ), name=col)
            cats.append(series)
        df = pd.concat([non_cat] + cats, axis=1)[self.columns_]
        return df
def inverse_transform ( self , X ) : non_cat = pd . DataFrame ( X [ : , : len ( self . non_cat_columns_ ) ] , columns = self . non_cat_columns_ ) cats = [ ] for col , cat in self . cat_map_ . items ( ) : slice_ = self . cat_blocks_ [ col ] codes = X [ : , slice_ ] . argmax ( 1 ) series = pd . Series ( pd . Categorical . from_codes ( codes , cat . categories , ordered = cat . ordered ) , name = col ) cats . append ( series ) df = pd . concat ( [ non_cat ] + cats , axis = 1 ) [ self . columns_ ] return df
Inverse Transform: numpy ndarray(matrix) to dataframe with original columns