class_docstr: Base probability distribution.
docstr: Sample from the distribution.
  
  Parameters
  ----------
  n_samples : int, optional, default = None
  
  Returns
  -------
  if `n_samples` is `None`:
  returns a sample that contains a single sample from `self`,
  in `pd.DataFrame` mtype format convention, with `index` and `columns` as `self`
  if n_samples is `int`:
  returns a `pd.DataFrame` that contains `n_samples` i.i.d. samples from `self`,
  in `pd-multiindex` mtype format convention, with same `columns` as `self`,
  and `MultiIndex` that is product of `RangeIndex(n_samples)` and `self.index`
docstr_tok: ["Sample","from","the","distribution",".","Parameters","--","--","--","--","--","n_samples",":","int",",","optional",",","default","=","None","Returns","--","--","--","-","if","`","n_samples","`","is","`","None","`",":","returns","a","sample","that","contains","a","single","sample","from","`","self","`",",","in","`","pd.DataFrame","`","mtype","format","convention",",","with","`","index","`","and","`","columns","`","as","`","self","`","if","n_samples","is","`","int","`",":","returns","a","`","pd.DataFrame","`","that","contains","`","n_samples","`","i.i.d",".","samples","from","`","self","`",",","in","`","pd-multiindex","`","mtype","format","convention",",","with","same","`","columns","`","as","`","self","`",",","and","`","MultiIndex","`","that","is","product","of","`","RangeIndex","(","n_samples",")","`","and","`","self.index","`"]
code: def sample(self, n_samples=None):
      """Sample from the distribution.
  
      Parameters
      ----------
      n_samples : int, optional, default = None
  
      Returns
      -------
      if `n_samples` is `None`:
      returns a sample that contains a single sample from `self`,
      in `pd.DataFrame` mtype format convention, with `index` and `columns` as `self`
      if n_samples is `int`:
      returns a `pd.DataFrame` that contains `n_samples` i.i.d. samples from `self`,
      in `pd-multiindex` mtype format convention, with same `columns` as `self`,
      and `MultiIndex` that is product of `RangeIndex(n_samples)` and `self.index`
      """
  
      def gen_unif():
          np_unif = np.random.uniform(size=self.shape)
          return pd.DataFrame(
              np_unif, index=self.index, columns=self.columns
          )
  
      # if ppf is implemented, we use inverse transform sampling
      if self._has_implementation_of("ppf"):
          if n_samples is None:
              return self.ppf(gen_unif())
          else:
              pd_smpl = [self.ppf(gen_unif()) for _ in range(n_samples)]
              df_spl = pd.concat(pd_smpl, keys=range(n_samples))
              return df_spl
  
      raise NotImplementedError(
          self._method_error_msg("sample", "error")
      )
  
imports: from warnings import warn
  import numpy
  import pandas
  from sktime.base import BaseObject
  from sktime.utils.pandas import df_map
  from sktime.utils.validation._dependencies import _check_estimator_deps
label_desc: Use image node_id 22 for calling the BaseDistribution obj's underlying member method code with example usage: obj.sample(n_samples) and returns: pd, self, df_spl