code: def conditional_entropy(
      x,
      y,
      nan_strategy=REPLACE,
      nan_replace_value=DEFAULT_REPLACE_VALUE,
  ):
      """
      Calculates the conditional entropy of x given y: S(x|y)
  
      Wikipedia: https://en.wikipedia.org/wiki/Conditional_entropy
  
      **Returns:** float
  
      Parameters
      ----------
      x : list / NumPy ndarray / Pandas Series
          A sequence of measurements
      y : list / NumPy ndarray / Pandas Series
          A sequence of 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)
      y_counter = Counter(y)
      xy_counter = Counter(list(zip(x, y)))
      total_occurrences = sum(y_counter.values())
      entropy = 0.0
      for xy in xy_counter.keys():
          p_xy = xy_counter[xy] / total_occurrences
          p_y = y_counter[xy[1]] / total_occurrences
          entropy += p_xy * math.log(p_y / p_xy)
      return entropy
  
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 4 for calling a global function with example usage: conditional_entropy(x, y, nan_strategy, nan_replace_value) and returns: entropy