SORT_VECTOR
The SORT_VECTOR node returns the input Vector that is sortedInputs
------
default : Vector
The input vectorParams:reverse : boolIf False, sort in ascending order. If True, descending order.Returns:out : VectorSorted input vector
Python Code
from flojoy import flojoy, Vector
@flojoy
def SORT_VECTOR(
default: Vector,
reverse: bool = False,
) -> Vector:
"""The SORT_VECTOR node returns the input Vector that is sorted
Inputs
------
default : Vector
The input vector
Parameters
----------
reverse : bool
If False, sort in ascending order. If True, descending order.
Returns
-------
Vector
Sorted input vector
"""
return Vector(v=sorted(default.v, reverse=reverse))
Example
Having problem with this example app? Join our Discord community and we will help you out!
In this example, we create a Vector type data that is in descending order using LINSPACE
.
Using SORT_VECTOR
node, we sort the Vector type data in ascending order.