code: def percentile_nearest(self, percentile):
      
  
      if self._input_csv_files:
        df = self._get_data_from_csv_files()
        if 'target' not in df or 'predicted' not in df:
          raise ValueError('Cannot find "target" or "predicted" column')
  
        df = df[['target', 'predicted']].apply(pd.to_numeric)
        abs_errors = np.array((df['target'] - df['predicted']).apply(abs))
        return np.percentile(abs_errors, percentile, interpolation='nearest')
      elif self._bigquery:
        query = bq.Query("""
          SELECT
            PERCENTILE_DISC(ABS(predicted-target), %f) OVER() AS percentile
          FROM
            %s
          LIMIT 1""" % (float(percentile) / 100, self._bigquery))
        df = self._get_data_from_bigquery([query])
        if df.empty:
          return None
        return df['percentile'][0]
docs: Get nearest percentile from regression model evaluation results.
  
      Args:
        percentile: a 0~100 float number.
  
      Returns:
        the percentile float number.
  
      Raises:
        Exception if the CSV headers do not include 'target' or 'predicted', or BigQuery
        does not return 'target' or 'predicted' column, or if target or predicted is not
        number.