code: def remove_terms_used_in_less_than_num_docs(self, threshold):
          '''
          Parameters
          ----------
          threshold: int
              Minimum number of documents term should appear in to be kept
  
          Returns
          -------
          TermDocMatrix, new object with terms removed.
          '''
          term_counts = self._X.astype(bool).astype(int).sum(axis=0).A[0]
          terms_to_remove = np.where(term_counts < threshold)[0]
          return self.remove_terms_by_indices(terms_to_removef remove_terms_used_in_less_than_num_docs(self, threshold):
          '''
          Parameters
          ----------
          threshold: int
              Minimum number of documents term should appear in to be kept
  
          Returns
          -------
          TermDocMatrix, new object with terms removed.
          '''
          term_counts = self._X.astype(bool).astype(int).sum(axis=0).A[0]
          terms_to_remove = np.where(term_counts < threshold)[0]
          return self.remove_terms_by_indices(terms_to_remove)
docs: Parameters
          ----------
          threshold: int
              Minimum number of documents term should appear in to be kept
  
          Returns
          -------
          TermDocMatrix, new object with terms removed.