code: def theils_u(
      y,
      x,
      nan_strategy=REPLACE,
      nan_replace_value=DEFAULT_REPLACE_VALUE,
  ):
      """
      IMPORTANT: look at the order of arguments y and x
  
      Calculates Theil's U statistic (Uncertainty coefficient) for categorical-
      categorical association. This is the uncertainty of x given y: value is
      on the range of [0,1] - where 0 means y provides no information about
      x, and 1 means y provides full information about x.
  
      This is an asymmetric coefficient: U(x,y) != U(y,x)
  
      Wikipedia: https://en.wikipedia.org/wiki/Uncertainty_coefficient
  
      **Returns:** float in the range of [0,1]
  
      Parameters
      ----------
      x : list / NumPy ndarray / Pandas Series
          A sequence of categorical measurements
      y : list / NumPy ndarray / Pandas Series
          A sequence of categorical measurements
      nan_strategy : string, default = 'replace'
          How to handle missing values: can be either 'drop' to remove samples
          with missing values, or 'replace' to replace all missing values with
          the nan_replace_value. Missing values are None and np.nan.
      nan_replace_value : any, default = 0.0
          The value used to replace missing values with. Only applicable when
          nan_strategy is set to 'replace'.
      """
      if nan_strategy == REPLACE:
          x, y = replace_nan_with_value(x, y, nan_replace_value)
      elif nan_strategy == DROP:
          x, y = remove_incomplete_samples(x, y)
      s_xy = conditional_entropy(x, y)
      x_counter = Counter(x)
      total_occurrences = sum(x_counter.values())
      p_x = list(
          map(lambda n: n / total_occurrences, x_counter.values())
      )
      s_x = ss.entropy(p_x)
      if s_x == 0:
          return 1
      else:
          return (s_x - s_xy) / s_x
  
file_path: sweetviz/sweetviz/from_dython.py
imports: import numpy
  import pandas
  from collections import Counter
  import math
  import scipy.stats
label_desc: Use image node_id 5 for calling a global function with example usage: theils_u(y, x, nan_strategy, nan_replace_value) and returns: int, unknown