nodes: 0, module; 1, function_definition; 2, function_name:heatmap; 3, parameters; 4, block; 5, identifier:df; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_parameter; 16, default_parameter; 17, default_parameter; 18, expression_statement; 19, comment:# Apply filters and sorts, set up the figure.; 20, expression_statement; 21, expression_statement; 22, expression_statement; 23, expression_statement; 24, expression_statement; 25, comment:# Remove completely filled or completely empty variables.; 26, expression_statement; 27, comment:# Create and mask the correlation matrix. Construct the base heatmap.; 28, expression_statement; 29, expression_statement; 30, expression_statement; 31, if_statement; 32, comment:# Apply visual corrections and modifications.; 33, expression_statement; 34, expression_statement; 35, expression_statement; 36, expression_statement; 37, expression_statement; 38, expression_statement; 39, expression_statement; 40, for_statement; 41, if_statement; 42, identifier:inline; 43, False; 44, identifier:filter; 45, None; 46, identifier:n; 47, integer:0; 48, identifier:p; 49, integer:0; 50, identifier:sort; 51, None; 52, identifier:figsize; 53, tuple; 54, identifier:fontsize; 55, integer:16; 56, identifier:labels; 57, True; 58, identifier:cmap; 59, string; 60, identifier:vmin; 61, unary_operator; 62, identifier:vmax; 63, integer:1; 64, identifier:cbar; 65, True; 66, comment:"""
      Presents a `seaborn` heatmap visualization of nullity correlation in the given DataFrame.
      
      Note that this visualization has no special support for large datasets. For those, try the dendrogram instead.
  
      :param df: The DataFrame whose completeness is being heatmapped.
      :param filter: The filter to apply to the heatmap. Should be one of "top", "bottom", or None (default). See
      `nullity_filter()` for more information.
      :param n: The cap on the number of columns to include in the filtered DataFrame. See  `nullity_filter()` for
      more information.
      :param p: The cap on the percentage fill of the columns in the filtered DataFrame. See  `nullity_filter()` for
      more information.
      :param sort: The sort to apply to the heatmap. Should be one of "ascending", "descending", or None. See
      `nullity_sort()` for more information.
      :param figsize: The size of the figure to display. This is a `matplotlib` parameter which defaults to (20, 12).
      :param fontsize: The figure's font size.
      :param labels: Whether or not to label each matrix entry with its correlation (default is True).
      :param cmap: What `matplotlib` colormap to use. Defaults to `RdBu`.
      :param vmin: The normalized colormap threshold. Defaults to -1, e.g. the bottom of the color scale.
      :param vmax: The normalized colormap threshold. Defaults to 1, e.g. the bottom of the color scale.
      :param inline: Whether or not the figure is inline. If it's not then instead of getting plotted, this method will
      return its figure.
      :return: If `inline` is False, the underlying `matplotlib.figure` object. Else, nothing.
      """; 67, assignment; 68, assignment; 69, call; 70, assignment; 71, assignment; 72, assignment; 73, assignment; 74, assignment; 75, assignment; 76, identifier:labels; 77, block; 78, else_clause; 79, call; 80, call; 81, call; 82, call; 83, call; 84, call; 85, call; 86, identifier:text; 87, attribute; 88, block; 89, identifier:inline; 90, block; 91, else_clause; 92, integer:20; 93, integer:12; 94, string_content:RdBu; 95, integer:1; 96, identifier:df; 97, call; 98, identifier:df; 99, call; 100, attribute; 101, argument_list; 102, identifier:gs; 103, call; 104, identifier:ax0; 105, call; 106, identifier:df; 107, subscript; 108, identifier:corr_mat; 109, call; 110, identifier:mask; 111, call; 112, subscript; 113, True; 114, expression_statement; 115, block; 116, attribute; 117, argument_list; 118, attribute; 119, argument_list; 120, attribute; 121, argument_list; 122, attribute; 123, argument_list; 124, attribute; 125, argument_list; 126, attribute; 127, argument_list; 128, attribute; 129, argument_list; 130, identifier:ax0; 131, identifier:texts; 132, expression_statement; 133, if_statement; 134, expression_statement; 135, block; 136, identifier:nullity_filter; 137, argument_list; 138, identifier:nullity_sort; 139, argument_list; 140, identifier:plt; 141, identifier:figure; 142, keyword_argument; 143, attribute; 144, argument_list; 145, attribute; 146, argument_list; 147, attribute; 148, slice; 149, list_comprehension; 150, attribute; 151, argument_list; 152, attribute; 153, argument_list; 154, identifier:mask; 155, call; 156, call; 157, expression_statement; 158, attribute; 159, identifier:tick_bottom; 160, identifier:ax0; 161, identifier:set_xticklabels; 162, call; 163, keyword_argument; 164, keyword_argument; 165, keyword_argument; 166, identifier:ax0; 167, identifier:set_yticklabels; 168, call; 169, keyword_argument; 170, keyword_argument; 171, identifier:ax0; 172, identifier:set_yticklabels; 173, call; 174, keyword_argument; 175, keyword_argument; 176, attribute; 177, identifier:set_ticks_position; 178, string; 179, attribute; 180, identifier:set_ticks_position; 181, string; 182, attribute; 183, identifier:set_visible; 184, False; 185, assignment; 186, comparison_operator:0.95 <= t < 1; 187, block; 188, elif_clause; 189, elif_clause; 190, elif_clause; 191, elif_clause; 192, else_clause; 193, call; 194, return_statement; 195, identifier:df; 196, keyword_argument; 197, keyword_argument; 198, keyword_argument; 199, identifier:df; 200, keyword_argument; 201, identifier:figsize; 202, identifier:figsize; 203, identifier:gridspec; 204, identifier:GridSpec; 205, integer:1; 206, integer:1; 207, identifier:plt; 208, identifier:subplot; 209, subscript; 210, identifier:df; 211, identifier:iloc; 212, identifier:i; 213, for_in_clause; 214, if_clause; 215, call; 216, identifier:corr; 217, identifier:np; 218, identifier:zeros_like; 219, identifier:corr_mat; 220, attribute; 221, argument_list; 222, attribute; 223, argument_list; 224, call; 225, identifier:ax0; 226, identifier:xaxis; 227, attribute; 228, argument_list; 229, identifier:rotation; 230, integer:45; 231, identifier:ha; 232, string; 233, identifier:fontsize; 234, identifier:fontsize; 235, attribute; 236, argument_list; 237, identifier:fontsize; 238, identifier:fontsize; 239, identifier:rotation; 240, integer:0; 241, attribute; 242, argument_list; 243, identifier:rotation; 244, integer:0; 245, identifier:fontsize; 246, identifier:fontsize; 247, identifier:ax0; 248, identifier:xaxis; 249, string_content:none; 250, identifier:ax0; 251, identifier:yaxis; 252, string_content:none; 253, identifier:ax0; 254, identifier:patch; 255, identifier:t; 256, call; 257, float:0.95; 258, identifier:t; 259, integer:1; 260, expression_statement; 261, comparison_operator:-1 < t <= -0.95; 262, block; 263, comparison_operator:t == 1; 264, block; 265, comparison_operator:t == -1; 266, block; 267, comparison_operator:-0.05 < t < 0.05; 268, block; 269, block; 270, attribute; 271, argument_list; 272, identifier:ax0; 273, identifier:filter; 274, identifier:filter; 275, identifier:n; 276, identifier:n; 277, identifier:p; 278, identifier:p; 279, identifier:sort; 280, identifier:sort; 281, identifier:gs; 282, integer:0; 283, pattern_list; 284, call; 285, comparison_operator:n > 0; 286, attribute; 287, argument_list; 288, identifier:np; 289, identifier:triu_indices_from; 290, identifier:mask; 291, identifier:sns; 292, identifier:heatmap; 293, identifier:corr_mat; 294, keyword_argument; 295, keyword_argument; 296, keyword_argument; 297, keyword_argument; 298, keyword_argument; 299, keyword_argument; 300, keyword_argument; 301, keyword_argument; 302, attribute; 303, argument_list; 304, attribute; 305, identifier:get_majorticklabels; 306, string_content:right; 307, attribute; 308, identifier:get_majorticklabels; 309, attribute; 310, identifier:get_majorticklabels; 311, identifier:float; 312, argument_list; 313, call; 314, unary_operator; 315, identifier:t; 316, unary_operator; 317, expression_statement; 318, identifier:t; 319, integer:1; 320, expression_statement; 321, identifier:t; 322, unary_operator; 323, expression_statement; 324, unary_operator; 325, identifier:t; 326, float:0.05; 327, expression_statement; 328, expression_statement; 329, identifier:plt; 330, identifier:show; 331, identifier:i; 332, identifier:n; 333, identifier:enumerate; 334, argument_list; 335, identifier:n; 336, integer:0; 337, identifier:df; 338, identifier:isnull; 339, identifier:mask; 340, identifier:mask; 341, identifier:cmap; 342, identifier:cmap; 343, identifier:ax; 344, identifier:ax0; 345, identifier:cbar; 346, identifier:cbar; 347, identifier:annot; 348, True; 349, identifier:annot_kws; 350, dictionary; 351, identifier:vmin; 352, identifier:vmin; 353, identifier:vmax; 354, identifier:vmax; 355, identifier:sns; 356, identifier:heatmap; 357, identifier:corr_mat; 358, keyword_argument; 359, keyword_argument; 360, keyword_argument; 361, keyword_argument; 362, keyword_argument; 363, keyword_argument; 364, identifier:ax0; 365, identifier:xaxis; 366, identifier:ax0; 367, identifier:yaxis; 368, identifier:ax0; 369, identifier:yaxis; 370, call; 371, attribute; 372, argument_list; 373, integer:1; 374, float:0.95; 375, call; 376, call; 377, integer:1; 378, call; 379, float:0.05; 380, call; 381, call; 382, call; 383, pair; 384, identifier:mask; 385, identifier:mask; 386, identifier:cmap; 387, identifier:cmap; 388, identifier:ax; 389, identifier:ax0; 390, identifier:cbar; 391, identifier:cbar; 392, identifier:vmin; 393, identifier:vmin; 394, identifier:vmax; 395, identifier:vmax; 396, attribute; 397, argument_list; 398, identifier:text; 399, identifier:set_text; 400, string; 401, attribute; 402, argument_list; 403, attribute; 404, argument_list; 405, attribute; 406, argument_list; 407, attribute; 408, argument_list; 409, attribute; 410, argument_list; 411, attribute; 412, argument_list; 413, string; 414, binary_operator:fontsize - 2; 415, identifier:text; 416, identifier:get_text; 417, string_content:<1; 418, identifier:text; 419, identifier:set_text; 420, string; 421, identifier:text; 422, identifier:set_text; 423, string; 424, identifier:text; 425, identifier:set_text; 426, string; 427, identifier:text; 428, identifier:set_text; 429, string; 430, identifier:text; 431, identifier:set_text; 432, call; 433, identifier:np; 434, identifier:var; 435, call; 436, keyword_argument; 437, string_content:size; 438, identifier:fontsize; 439, integer:2; 440, string_content:>-1; 441, string_content:1; 442, string_content:-1; 443, identifier:round; 444, argument_list; 445, attribute; 446, argument_list; 447, identifier:axis; 448, string; 449, identifier:t; 450, integer:1; 451, identifier:df; 452, identifier:isnull; 453, string_content:rows
code: def heatmap(df, inline=False,
              filter=None, n=0, p=0, sort=None,
              figsize=(20, 12), fontsize=16, labels=True, 
              cmap='RdBu', vmin=-1, vmax=1, cbar=True
              ):
      """
      Presents a `seaborn` heatmap visualization of nullity correlation in the given DataFrame.
      
      Note that this visualization has no special support for large datasets. For those, try the dendrogram instead.
  
      :param df: The DataFrame whose completeness is being heatmapped.
      :param filter: The filter to apply to the heatmap. Should be one of "top", "bottom", or None (default). See
      `nullity_filter()` for more information.
      :param n: The cap on the number of columns to include in the filtered DataFrame. See  `nullity_filter()` for
      more information.
      :param p: The cap on the percentage fill of the columns in the filtered DataFrame. See  `nullity_filter()` for
      more information.
      :param sort: The sort to apply to the heatmap. Should be one of "ascending", "descending", or None. See
      `nullity_sort()` for more information.
      :param figsize: The size of the figure to display. This is a `matplotlib` parameter which defaults to (20, 12).
      :param fontsize: The figure's font size.
      :param labels: Whether or not to label each matrix entry with its correlation (default is True).
      :param cmap: What `matplotlib` colormap to use. Defaults to `RdBu`.
      :param vmin: The normalized colormap threshold. Defaults to -1, e.g. the bottom of the color scale.
      :param vmax: The normalized colormap threshold. Defaults to 1, e.g. the bottom of the color scale.
      :param inline: Whether or not the figure is inline. If it's not then instead of getting plotted, this method will
      return its figure.
      :return: If `inline` is False, the underlying `matplotlib.figure` object. Else, nothing.
      """
      # Apply filters and sorts, set up the figure.
      df = nullity_filter(df, filter=filter, n=n, p=p)
      df = nullity_sort(df, sort=sort)
  
      plt.figure(figsize=figsize)
      gs = gridspec.GridSpec(1, 1)
      ax0 = plt.subplot(gs[0])
  
      # Remove completely filled or completely empty variables.
      df = df.iloc[:,[i for i, n in enumerate(np.var(df.isnull(), axis='rows')) if n > 0]]
  
      # Create and mask the correlation matrix. Construct the base heatmap.
      corr_mat = df.isnull().corr()
      mask = np.zeros_like(corr_mat)
      mask[np.triu_indices_from(mask)] = True
  
      if labels:
          sns.heatmap(corr_mat, mask=mask, cmap=cmap, ax=ax0, cbar=cbar,
                      annot=True, annot_kws={'size': fontsize - 2},
                      vmin=vmin, vmax=vmax)
      else:
          sns.heatmap(corr_mat, mask=mask, cmap=cmap, ax=ax0, cbar=cbar,
                      vmin=vmin, vmax=vmax)
  
      # Apply visual corrections and modifications.
      ax0.xaxis.tick_bottom()
      ax0.set_xticklabels(ax0.xaxis.get_majorticklabels(), rotation=45, ha='right', fontsize=fontsize)
      ax0.set_yticklabels(ax0.yaxis.get_majorticklabels(), fontsize=fontsize, rotation=0)
      ax0.set_yticklabels(ax0.yaxis.get_majorticklabels(), rotation=0, fontsize=fontsize)
      ax0.xaxis.set_ticks_position('none')
      ax0.yaxis.set_ticks_position('none')
      ax0.patch.set_visible(False)
  
      for text in ax0.texts:
          t = float(text.get_text())
          if 0.95 <= t < 1:
              text.set_text('<1')
          elif -1 < t <= -0.95:
              text.set_text('>-1')
          elif t == 1:
              text.set_text('1')
          elif t == -1:
              text.set_text('-1')
          elif -0.05 < t < 0.05:
              text.set_text('')
          else:
              text.set_text(round(t, 1))
  
      if inline:
          plt.show()
      else:
          return ax0