code: def ampute_data(
      data: _t_dat,
      variables: Optional[_t_var_list] = None,
      perc: float = 0.1,
      random_state: _t_random_state = None,
  ):
      """
      Ampute Data
  
      Returns a copy of data with specified variables amputed.
  
      Parameters
      ----------
       data : Pandas DataFrame
          The data to ampute
  
       variables : None or list
          If None, are variables are amputed.
  
       perc : double
          The percentage of the data to ampute.
  
      random_state: None, int, or np.random.RandomState
          The random state to use.
  
      Returns
      -------
      pandas DataFrame
          The amputed data
      """
      amputed_data = data.copy()
      data_shape = amputed_data.shape
      amp_rows = int(perc * data_shape[0])
      random_state = ensure_rng(random_state)
  
      if len(data_shape) > 1:
          if variables is None:
              variables = [i for i in range(amputed_data.shape[1])]
          elif isinstance(variables, list):
              if isinstance(variables[0], str):
                  assert isinstance(
                      data, pd_DataFrame
                  ), "np array was passed but variables are strings"
                  variables = [
                      data.columns.tolist().index(i) for i in variables
                  ]
  
          if isinstance(amputed_data, pd_DataFrame):
              for v in variables:
                  na_ind = random_state.choice(
                      np.arange(data_shape[0]),
                      replace=False,
                      size=amp_rows,
                  )
                  amputed_data.iloc[na_ind, v] = np.NaN
  
          if isinstance(amputed_data, np.ndarray):
              amputed_data = amputed_data.astype("float64")
              for v in variables:
                  na_ind = random_state.choice(
                      np.arange(data_shape[0]),
                      replace=False,
                      size=amp_rows,
                  )
                  amputed_data[na_ind, v] = np.NaN
  
      else:
          na_ind = random_state.choice(
              np.arange(data_shape[0]), replace=False, size=amp_rows
          )
          amputed_data[na_ind] = np.NaN
  
      return amputed_data
  
imports: from .compat import pd_DataFrame, pd_Series, pd_read_parquet
  import numpy
  from numpy.random import RandomState
  import blosc
  import dill
  from typing import Union, List, Dict, Optional
label_desc: Use image node_id 1 for calling a global function with example usage: ampute_data(data, variables, perc, random_state) and returns: amputed_data