polars.Series.diff#

Series.diff(n: int = 1, null_behavior: NullBehavior = 'ignore') Series[source]#

Calculate the n-th discrete difference.

Parameters:
n

Number of slots to shift.

null_behavior{‘ignore’, ‘drop’}

How to handle null values.