Encodes matrix

        :return: Encoder used

def encode(self):
        """Encodes matrix

        :return: Encoder used
        """
        encoder = LabelEncoder()  # encoder
        values = self.get_as_list()
        encoded = encoder.fit_transform(values)  # long list of encoded
        n_columns = len(self.matrix[0])
        n_rows = len(self.matrix)

        self.matrix = [
            encoded[i: i + n_columns]
            for i in range(0, n_rows * n_columns, n_columns)
        ]

        return encoder