def print_matrix(self, n_rows=None, n_cols=None):
        # We need to get it to a list of list representation for tabulate

        if n_cols is None:
            n_cols = self._display_max_cols
        if n_rows is None:
            n_rows = self._display_max_rows
        n_rows = min(n_rows, self.shape[0])
        n_cols = min(n_cols, self.shape[1])
        mat = self.matrix[:n_rows, :n_cols]

        # Add column words
        res = [[str(list(self.shape))] + self.col2word[:n_cols]]

        # Add row words
        res += [[self.row2word[i]] + ["{0:0.2f}".format(val) for val in row] for i, row in enumerate(mat.todense().tolist())]

        # Add ellipses
        if n_cols < self.shape[1]:
            [row.append("...") for row in res]
        if n_rows < self.shape[0]:
            res.append(["..."] * len(res[0]))

        table = tabulate(res, tablefmt='plain')
        return table
Prints n_rows and n_cols of the matrix. If either is set to None, print the standard amount.
dataset/ETHPy150Open jimmycallin/pydsm/pydsm/indexmatrix.py/IndexMatrix.print_matrix