Sort by Columns

Modified on Tue, 7 Feb, 2023 at 5:07 PM

Description

This function allows to sort the dataset by one or multiple columns.


Application

Most of the functions don’t ensure a certain order of the data. If for any function you need the data in a certain order you can use this step to sort it according to your requirements. For example, Line Plots or Validation Plots require sorted data, otherwise the line will jump randomly from point to point.


How to use

  • Choose the dataset to work on in the field Data.
  • Choose the column(s) by which to sort group the dataset in the field sortByColumns.
    • You can choose either a single or multiple columns to sort.
    • The columns can be numerical and/or categorical.
    • The order in which you choose the columns is important! The dataset will be sorted according to the order of the selected columns.
    • For each selected column you can choose between ascending or descending sorting order. Ascending  is preselected by default.
  • The option NaN field controls how missing values (NaN = Not a Number) should be handled. They can either be put before all other data (first) or to the end of the dataset (last). Last is preselected by default.
  • You can save the newly sorted dataset under a new name. For this, enable the option Save output under different name.
  • Click Apply to execute the sort operation.

Examples

Consider the following dataset with one numerical and one categorical column which is already ordered. This result could be achieved if Column 1 and Column 2 are selected in the field sortByColumns in this order: Column 1, Column 2.

IDColumn 1Column 2
1A1
2A2
3A3
4B1
5B2
6C1
7C2
8C3

If the order of the selection is changed to Column 2, Column 1 the resulting table would look like this:

IDColumn 1Column 2
1A1
4
B
1
6
C
1
2
A
2
5
B2
7
C2
3
A
3
8C3

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article