OrderBy gem
Sorts a model on one or more columns in ascending or descending order.
Interactive Gem Example
The OrderBy gem has a corresponding interactive gem example. See Interactive gem examples to learn how to run sample pipelines for this and other gems.
Parameters
| Parameter | Description | Required |
|---|---|---|
| Order columns | Columns to sort the model by | True |
| Sort | Order of sorting (ascending or descending) | True |
Example
Assume you have the following weather prediction table.
| DatePrediction | TemperatureCelsius | HumidityPercent | WindSpeed | Condition |
|---|---|---|---|---|
| 2025-03-01 | 15 | 65 | 10 | Sunny |
| 2025-03-02 | 17 | 70 | 12 | Cloudy |
| 2025-03-03 | 16 | 68 | 11 | Rainy |
| 2025-03-04 | 14 | 72 | 9 | Sunny |
Result
The follow table results when you order by the HumidityPercent column in ascending order.
| DatePrediction | TemperatureCelsius | HumidityPercent | WindSpeed | Condition |
|---|---|---|---|---|
| 2025-03-01 | 15 | 65 | 10 | Sunny |
| 2025-03-03 | 16 | 68 | 11 | Rainy |
| 2025-03-02 | 17 | 70 | 12 | Cloudy |
| 2025-03-04 | 14 | 72 | 9 | Sunny |