Reversing Table Order
Users may want to reverse the order of the rows in an entire table, where the last row becomes the first row and vice versa. Deephaven offer two ways to accomplish this: by using the reverse
method in a query, or through the Deephaven console. For information, please refer to: Right-Click Shortcuts > Reverse Table. The following section details how to reverse table order using the query language.
Reversing Table Order Through a Query
The reverse
method can be used in a query to reverse an entire Deephaven table. An example of this follows:
t1=db.t("LearnDeephaven", "StockTrades").where("Date=`2017-08-21`")
t2=t1.reverse()
The first line of the query above generates the t1
table using data from the StockTrades
table located in the LearnDeephaven
namespace. The following image shows the first 10 rows in the t1
table:
The second line of the query creates the t2
table by reversing the order of the t1
table. The following screenshot demonstrates how the first 10 rows from the t1
table (above) are now presented as the last five rows in the t2
table (below):
See Right-Click Shortcuts > Reverse Table for examples showing table reversing before and after sorting.
Last Updated: 16 February 2021 18:07 -04:00 UTC Deephaven v.1.20200928 (See other versions)
Deephaven Documentation Copyright 2016-2020 Deephaven Data Labs, LLC All Rights Reserved