code: def probs(x, given, df: pd.DataFrame, how="index"):
      """Produces a Dense Matrix of the conditional probability of x given `y=given`
  
      Args:
          x: the column variable of interest given the column 'y'
          given : the variabe to fix constant
          df pd.DataFrame: dataframe
          how (str, optional): One of 'column' or 'index'. Defaults to 'index'.
  
      Returns:
          pd.DataFrame: the conditional probability of x given the column 'y'
          as dense array like dataframe
      """
      assert how in [
          "index",
          "columns",
      ], "how must be one of 'index' or 'columns'"
      res = pd.crosstab(df[x], df[given], margins=True, normalize=how)
      if (
          how == "index"
      ):  # normalize over columns so .sum(0) = 1 irrespective of `how`
          return res.T
      return res
  
file_path: pygraphistry/graphistry/compute/conditional.py
imports: import logging
  import pandas
  from typing import Any, List, Union, TYPE_CHECKING
  from typing_extensions import Literal
  from graphistry.Engine import Engine
  from graphistry.Plottable import Plottable
label_desc: Use image node_id 2 for calling a global function with example usage: probs(x, given, df, how) and returns: res, res