nodes: 0, module; 1, function_definition; 2, function_name:almost_equal; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, identifier:bool; 9, expression_statement; 10, if_statement; 11, identifier:f; 12, type; 13, identifier:g; 14, type; 15, comment:"""
      Return ``True`` if and only if the given DataFrames are equal after
      sorting their columns names, sorting their values, and
      reseting their indices.
      """; 16, boolean_operator; 17, block; 18, else_clause; 19, identifier:DataFrame; 20, identifier:DataFrame; 21, attribute; 22, attribute; 23, return_statement; 24, comment:# Put in canonical order; 25, block; 26, identifier:f; 27, identifier:empty; 28, identifier:g; 29, identifier:empty; 30, call; 31, expression_statement; 32, expression_statement; 33, return_statement; 34, attribute; 35, argument_list; 36, assignment; 37, assignment; 38, call; 39, identifier:f; 40, identifier:equals; 41, identifier:g; 42, identifier:F; 43, parenthesized_expression; 44, identifier:G; 45, parenthesized_expression; 46, attribute; 47, argument_list; 48, call; 49, call; 50, identifier:F; 51, identifier:equals; 52, identifier:G; 53, attribute; 54, argument_list; 55, attribute; 56, argument_list; 57, call; 58, identifier:reset_index; 59, keyword_argument; 60, call; 61, identifier:reset_index; 62, keyword_argument; 63, attribute; 64, argument_list; 65, identifier:drop; 66, True; 67, attribute; 68, argument_list; 69, identifier:drop; 70, True; 71, call; 72, identifier:sort_values; 73, call; 74, call; 75, identifier:sort_values; 76, call; 77, attribute; 78, argument_list; 79, identifier:list; 80, argument_list; 81, attribute; 82, argument_list; 83, identifier:list; 84, argument_list; 85, identifier:f; 86, identifier:sort_index; 87, keyword_argument; 88, attribute; 89, identifier:g; 90, identifier:sort_index; 91, keyword_argument; 92, attribute; 93, identifier:axis; 94, integer:1; 95, identifier:f; 96, identifier:columns; 97, identifier:axis; 98, integer:1; 99, identifier:g; 100, identifier:columns
code: def almost_equal(f: DataFrame, g: DataFrame) -> bool:
      """
      Return ``True`` if and only if the given DataFrames are equal after
      sorting their columns names, sorting their values, and
      reseting their indices.
      """
      if f.empty or g.empty:
          return f.equals(g)
      else:
          # Put in canonical order
          F = (
              f.sort_index(axis=1)
              .sort_values(list(f.columns))
              .reset_index(drop=True)
          )
          G = (
              g.sort_index(axis=1)
              .sort_values(list(g.columns))
              .reset_index(drop=True)
          )
          return F.equals(G)