code: def _check_missing_values(series, warn_vals, err_vals=None):
      """Checks for excess missing values after making a series regular.
  
      After setting of automatic granularity and/or making a time series regular,
      it may contain a large number of missing values. This method will throw
      an error or warning if a series contains a high fraction or raw number
      missing values. See _ERR_VALS and WARN_VALS for thresholds.
  
      Args:
        series: instance of `pd.Series` or `pd.DataFrame`.
        warn_vals: optional instance of `tfp.sts.MissingValuesTolerance`
          specifying thresholds at which to warn about too many missing values.
        err_vals: optional instance of `tfp.sts.MissingValuesTolerance`
          specifying thresholds at which to raise an error about too many missing
          values.
          Default value: `None`.
  
      Raises:
        ValueError: if the series contains too many missing values.
      """
      missing_number = np.sum(np.isnan(series.values))
      total_number = np.prod(series.shape)
      missing_fraction = missing_number / total_number
      missing_msg = "Too many missing values: {} out of {}.".format(
          missing_number, total_number
      )
      warning_msg = "Large number of missing values: {}".format(
          missing_msg
      )
  
      # Raise an Error (default) or warning if too many missing values.
      if err_vals:
          if (
              missing_fraction >= err_vals.overall_fraction
              or (
                  missing_fraction
                  >= err_vals.fraction_low_missing_number
                  and missing_number >= err_vals.low_missing_number
              )
              or (
                  missing_fraction
                  >= err_vals.fraction_high_missing_number
                  and missing_number >= err_vals.high_missing_number
              )
          ):
              raise ValueError(
                  "Too many missing values: " + missing_msg
              )
  
      # Raise a warning in case of a lot of missing values.
      if (
          missing_fraction >= warn_vals.overall_fraction
          or (
              missing_fraction >= warn_vals.fraction_low_missing_number
              and missing_number >= warn_vals.low_missing_number
          )
          or (
              missing_fraction >= warn_vals.fraction_high_missing_number
              and missing_number >= warn_vals.high_missing_number
          )
      ):
          warnings.warn(warning_msg)
  
file_path: probability/tensorflow_probability/python/sts/regularization.py
imports: import collections
  import itertools
  import math
  import warnings
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _check_missing_values(series, warn_vals, err_vals) without return types