Diff / Computation Layer

Calculate differences between elements in a column shifted by a specified number of positions. Similar to pandas diff() or numpy.diff().

Mathematical form: where:

  • is the current position
  • is the shift amount
  • First positions will be null

Applications:

  • Time series analysis
  • Rate of change calculations
  • Sequential pattern detection
  • Trend analysis

Note: Positive shift looks backward, negative shift looks forward. Null values in input produce null differences.

Table
0
0
Table

Select

column

The numeric column to compute differences. Examples with shift=1:

  • Input: [2, 4, 6, 8] → Output: [null, 2, 2, 2]
  • Input: [10, 7, 5, 2] → Output: [null, -3, -2, -3]

Must be a numeric column type

The number of positions to offset for difference calculation:

  • Positive: compare with previous values
  • Negative: compare with following values
  • 1: adjacent differences
  • 2: skip one position Larger shifts result in more null values

Name for the new column. If not provided, the system generates a unique name. If AsColumn matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.