December 2018
Beginner to intermediate
500 pages
12h 10m
English
Query also provides a sorting macro named @orderby. It takes a list of attributes upon which to apply the sorting. Similar to SQL, the order is ascending by default, but we can change that by using the descending function.
Given our previously defined products_info DataFrame, we can easily sort it as needed, for example, with the most expensive products first and then by product name:
julia> @from p in products_info begin
@orderby descending(p.price), p.produce
@select p
@collect DataFrame
end
The snippet shows how to employ @orderby to sort the values in the source. Unsurprisingly, the resulting DataFrame will be properly sorted with the most expensive products on top:
All right, that was quite a detour! But now that we have knowledge ...
Read now
Unlock full access