Skip to main content

Table.sort_columns

sort_columnsordertext_ordering

Group: Selections

Documentation

Reorders the columns sorted by name in the specified order and the text ordering method. By default, sorting will be according to case-sensitive ascending order.

Arguments

  • order: Whether sorting should be in ascending or descending order.
  • text_ordering: Specifies whether to use dictionary, case-insensitive or case-sensitive ordering. By default, case-sensitive ordering is used.

Examples

Sort columns according to the default ordering.

      table = Table.from_rows ["bar","foo","buzz","bizz"] [["John", "25","abc","123"]]
output = table.sort_columns

Returns a Table

barbizzbuzzfoo
John123abc25

Sort columns according to the natural case-insensitive ordering.

      table = Table.from_rows ["Bar","foo","buzz","Bizz"] [["John", "25","abc","123"]]
output = table.sort_columns (..Case_Insensitive sort_digits_as_numbers=True)

Returns a Table

BarBizzbuzzfoo
John123abc25

Sort columns in descending order.

      table = Table.from_rows ["bar","foo","buzz","bizz"] [["John", "25","abc","123"]]
output = table.sort_columns ..Descending

Returns a Table

foobuzzbizzbar
25abc123John

Remarks

Unicode Normalization

The text ordering method uses Unicode normalization to ensure that the text is sorted correctly. This means that text that looks the same but is represented differently will be sorted in the same way.