move_columns_up
The move_columns_up
method creates a new table with specified columns appearing first in order, to the far left.
Syntax
move_columns_up(cols: Union[str, Sequence[str]]) -> Table
Parameters
Parameter | Type | Description |
---|---|---|
cols | Union[str, Sequence[str]] | Columns to move to the left side of the new table. |
Returns
A new table with specified columns appearing first in order, to the far left.
Examples
The following query moves column B
to the first position in the resulting table.
from deephaven import new_table
from deephaven.column import string_col, int_col
source = new_table(
[
string_col("A", ["apple", "apple", "orange", "orange", "plum", "plum"]),
int_col("B", [1, 1, 2, 2, 3, 3]),
string_col(
"C", ["Macoun", "Opal", "Navel", "Cara Cara ", "Greengage", "Mirabelle"]
),
int_col("D", [1, 2, 12, 3, 2, 3]),
]
)
result = source.move_columns_up(cols=["B"])
- source
- result
The following example moves columns B
and D
to the first positions in the resulting table.
from deephaven import new_table
from deephaven.column import string_col, int_col
source = new_table(
[
string_col("A", ["apple", "apple", "orange", "orange", "plum", "plum"]),
int_col("B", [1, 1, 2, 2, 3, 3]),
string_col(
"C", ["Macoun", "Opal", "Navel", "Cara Cara ", "Greengage", "Mirabelle"]
),
int_col("D", [1, 2, 12, 3, 2, 3]),
]
)
result = source.move_columns_up(cols=["B", "D"])
- source
- result