nodes: 0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:column_or_label; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, assert_statement; 13, if_statement; 14, return_statement; 15, identifier:descending; 16, False; 17, identifier:distinct; 18, False; 19, comment:"""Return a Table of rows sorted according to the values in a column.
  
          Args:
              ``column_or_label``: the column whose values are used for sorting.
  
              ``descending``: if True, sorting will be in descending, rather than
                  ascending order.
  
              ``distinct``: if True, repeated values in ``column_or_label`` will
                  be omitted.
  
          Returns:
              An instance of ``Table`` containing rows sorted based on the values
              in ``column_or_label``.
  
          >>> marbles = Table().with_columns(
          ...    "Color", make_array("Red", "Green", "Blue", "Red", "Green", "Green"),
          ...    "Shape", make_array("Round", "Rectangular", "Rectangular", "Round", "Rectangular", "Round"),
          ...    "Amount", make_array(4, 6, 12, 7, 9, 2),
          ...    "Price", make_array(1.30, 1.30, 2.00, 1.75, 1.40, 1.00))
          >>> marbles
          Color | Shape       | Amount | Price
          Red   | Round       | 4      | 1.3
          Green | Rectangular | 6      | 1.3
          Blue  | Rectangular | 12     | 2
          Red   | Round       | 7      | 1.75
          Green | Rectangular | 9      | 1.4
          Green | Round       | 2      | 1
          >>> marbles.sort("Amount")
          Color | Shape       | Amount | Price
          Green | Round       | 2      | 1
          Red   | Round       | 4      | 1.3
          Green | Rectangular | 6      | 1.3
          Red   | Round       | 7      | 1.75
          Green | Rectangular | 9      | 1.4
          Blue  | Rectangular | 12     | 2
          >>> marbles.sort("Amount", descending = True)
          Color | Shape       | Amount | Price
          Blue  | Rectangular | 12     | 2
          Green | Rectangular | 9      | 1.4
          Red   | Round       | 7      | 1.75
          Green | Rectangular | 6      | 1.3
          Red   | Round       | 4      | 1.3
          Green | Round       | 2      | 1
          >>> marbles.sort(3) # the Price column
          Color | Shape       | Amount | Price
          Green | Round       | 2      | 1
          Red   | Round       | 4      | 1.3
          Green | Rectangular | 6      | 1.3
          Green | Rectangular | 9      | 1.4
          Red   | Round       | 7      | 1.75
          Blue  | Rectangular | 12     | 2
          >>> marbles.sort(3, distinct = True)
          Color | Shape       | Amount | Price
          Green | Round       | 2      | 1
          Red   | Round       | 4      | 1.3
          Green | Rectangular | 9      | 1.4
          Red   | Round       | 7      | 1.75
          Blue  | Rectangular | 12     | 2
          """; 20, assignment; 21, identifier:distinct; 22, block; 23, else_clause; 24, call; 25, identifier:row_numbers; 26, identifier:descending; 27, block; 28, call; 29, identifier:column; 30, call; 31, expression_statement; 32, block; 33, attribute; 34, argument_list; 35, expression_statement; 36, attribute; 37, argument_list; 38, attribute; 39, argument_list; 40, assignment; 41, expression_statement; 42, parenthesized_expression; 43, identifier:all; 44, assignment; 45, identifier:self; 46, identifier:take; 47, identifier:row_numbers; 48, identifier:self; 49, identifier:_get_column; 50, identifier:column_or_label; 51, pattern_list; 52, call; 53, assignment; 54, comparison_operator:row_numbers < self.num_rows; 55, identifier:row_numbers; 56, call; 57, identifier:_; 58, identifier:row_numbers; 59, attribute; 60, argument_list; 61, identifier:row_numbers; 62, call; 63, identifier:row_numbers; 64, attribute; 65, attribute; 66, argument_list; 67, identifier:np; 68, identifier:unique; 69, identifier:column; 70, keyword_argument; 71, attribute; 72, argument_list; 73, identifier:self; 74, identifier:num_rows; 75, identifier:np; 76, identifier:array; 77, subscript; 78, identifier:return_index; 79, True; 80, identifier:np; 81, identifier:argsort; 82, identifier:column; 83, keyword_argument; 84, keyword_argument; 85, identifier:row_numbers; 86, slice; 87, identifier:axis; 88, integer:0; 89, identifier:kind; 90, string; 91, unary_operator; 92, string_content:mergesort; 93, integer:1
code: def sort(self, column_or_label, descending=False, distinct=False):
          """Return a Table of rows sorted according to the values in a column.
  
          Args:
              ``column_or_label``: the column whose values are used for sorting.
  
              ``descending``: if True, sorting will be in descending, rather than
                  ascending order.
  
              ``distinct``: if True, repeated values in ``column_or_label`` will
                  be omitted.
  
          Returns:
              An instance of ``Table`` containing rows sorted based on the values
              in ``column_or_label``.
  
          >>> marbles = Table().with_columns(
          ...    "Color", make_array("Red", "Green", "Blue", "Red", "Green", "Green"),
          ...    "Shape", make_array("Round", "Rectangular", "Rectangular", "Round", "Rectangular", "Round"),
          ...    "Amount", make_array(4, 6, 12, 7, 9, 2),
          ...    "Price", make_array(1.30, 1.30, 2.00, 1.75, 1.40, 1.00))
          >>> marbles
          Color | Shape       | Amount | Price
          Red   | Round       | 4      | 1.3
          Green | Rectangular | 6      | 1.3
          Blue  | Rectangular | 12     | 2
          Red   | Round       | 7      | 1.75
          Green | Rectangular | 9      | 1.4
          Green | Round       | 2      | 1
          >>> marbles.sort("Amount")
          Color | Shape       | Amount | Price
          Green | Round       | 2      | 1
          Red   | Round       | 4      | 1.3
          Green | Rectangular | 6      | 1.3
          Red   | Round       | 7      | 1.75
          Green | Rectangular | 9      | 1.4
          Blue  | Rectangular | 12     | 2
          >>> marbles.sort("Amount", descending = True)
          Color | Shape       | Amount | Price
          Blue  | Rectangular | 12     | 2
          Green | Rectangular | 9      | 1.4
          Red   | Round       | 7      | 1.75
          Green | Rectangular | 6      | 1.3
          Red   | Round       | 4      | 1.3
          Green | Round       | 2      | 1
          >>> marbles.sort(3) # the Price column
          Color | Shape       | Amount | Price
          Green | Round       | 2      | 1
          Red   | Round       | 4      | 1.3
          Green | Rectangular | 6      | 1.3
          Green | Rectangular | 9      | 1.4
          Red   | Round       | 7      | 1.75
          Blue  | Rectangular | 12     | 2
          >>> marbles.sort(3, distinct = True)
          Color | Shape       | Amount | Price
          Green | Round       | 2      | 1
          Red   | Round       | 4      | 1.3
          Green | Rectangular | 9      | 1.4
          Red   | Round       | 7      | 1.75
          Blue  | Rectangular | 12     | 2
          """
          column = self._get_column(column_or_label)
          if distinct:
              _, row_numbers = np.unique(column, return_index=True)
          else:
              row_numbers = np.argsort(column, axis=0, kind='mergesort')
          assert (row_numbers < self.num_rows).all(), row_numbers
          if descending:
              row_numbers = np.array(row_numbers[::-1])
          return self.take(row_numbers)