SHIFT_VECTOR
 
 The SHIFT_VECTOR node shifts the elements in the vector by the amount specified Inputs
------
v : Vector
    The input vector to shift elements from  Params:    shift : int  the number of places in which elements are moved (negative values will shift them to the left)     Returns:    out : Vector  The new vector with elements shifted    
   Python Code
from numpy import roll
from flojoy import flojoy, Vector
@flojoy
def SHIFT_VECTOR(default: Vector, shift: int = 1) -> Vector:
    """The SHIFT_VECTOR node shifts the elements in the vector by the amount specified
    Inputs
    ------
    v : Vector
        The input vector to shift elements from
    Parameters
    ----------
    shift: int
        the number of places in which elements are moved (negative values will shift them to the left)
    Returns
    -------
    Vector
        The new vector with elements shifted
    """
    v = roll(default.v, shift)
    return Vector(v=v)
Example
Having problems with this example app? Join our Discord community and we will help you out!
In this example, we generate a vector by using a LINSPACE node. Then specify the amount to shift in the vector with ROTATE_VECTOR node. In this case, we are only shifting 3 places to the right. The resulting vector is visualized with SCATTER node.