sort_by
Builtin index · Collections & strings
result = sort_by(df, "col", [descending])
Input: df, "col", descending · Output: result
What it is
df is a Table; "col" is a Str column name; optional descending (bool, default false).
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = sort_by(df, "col", [descending]) | df Tabledf is a Table."col" Str"col" is a Str column name.descending bool, optionaloptional descending (bool, default false). | result Table | Returns a Table sorted by that one column. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
df = table(x=[1,2,3,-1,5], y=[10,20,-5,7,2])
pos = filter(df, df.x > 0)
print(pos)
s = sort_by(df, "y")
print(s)
g = table(grp=[1,1,2,2], v=[10,20,30,40])
agg = group_by_agg(g, "grp", "v", "mean")
print(agg)
output
x y
- --
1 10
2 20
3 -5
5 2
x y
-- --
3 -5
5 2
-1 7
1 10
2 20
grp mean_v
... 3 more linesfrom tour