How to shift record of one field above or below
I want to shift data of a field same as we do using pandas shift method ,
how we can do this data 360 analyze
-
Please see the attached example data flow.
The 'Shift_Forward_Field' Transform node shifts the values of the specified 'fieldToShift' field ("color" in this case) forward by one index position relative to the rest of the fields in the record. If the 'fillValue' variable is not Null, the value is used in the first output record else the value output will be Null.
The Shift_Back_Field Transform node shifts the values of the specified 'fieldToShift' field ("color" in this case) back by one index position relative to the rest of the fields in the record. If the 'fieldToShift' field is Null then the node simply shifts the entire record back by one index position. In either case, the a final record is output with all Null values to emulate the operation of the pandas shift function.
Note, if you just wanted to calculate the numeric change in the value of a field from one record to the next then you can use the approach shown in the 'Calculate Change from Previous Record' Transform node.
-
Attached files
Shift _Field_Example - 12 Oct 2021.lna
Please sign in to leave a comment.
Comments
3 comments