code: def to_df(self) -> pd.DataFrame:
          
          if issparse(self._X):
              X = self._X.toarray()
          else:
              X = self._X
          return pd.DataFrame(X, index=self.obs_names, columns=self.var_names)
docs: Generate shallow :class:`~pandas.DataFrame`.
  
          The data matrix :attr:`X` is returned as
          :class:`~pandas.DataFrame`, where :attr:`obs_names` initializes the
          index, and :attr:`var_names` the columns.
  
          * No annotations are maintained in the returned object.
          * The data matrix is densified in case it is sparse.