7.2 Missing and irregular timestamps in cuDF

NCA-ADS · Advance Data Structures (7% of the exam) · Official objective: “Managing missing or irregular timestamps with cuDF interpolation”

interpolate() and resample().

Key points

  1. Interpolation estimates missing values from their neighbors. Linear interpolation assumes a straight line between the known points. With irregular timestamps, method='index' uses the time index as the x-axis. NaN means not a number.

    What NVIDIA says (3)

    “Parameters : method str, default ‘linear’ Interpolation technique to use.”

    — cuDF API: DataFrame.interpolate

    “Returns the same object type as the caller, interpolated at some or all NaN values”

    — cuDF API: DataFrame.interpolate

    “‘index’, ‘values’: linearly interpolate using the index as an x-axis.”

    — cuDF API: DataFrame.interpolate

  2. Resampling regroups time series data onto a new, fixed time grid. You then aggregate (or interpolate) within each bin.

    What NVIDIA says (2)

    “Parameters : rule: str The offset string representing the frequency to use.”

    — cuDF API: DataFrame.resample

    “First, we create a time series with 1 minute intervals”

    — cuDF API: DataFrame.resample

Key terms

Try it

Sample question

A sensor series in cuDF has gaps (NaN values). Which method fills them by drawing straight lines between known points?

Show the answer

Answer: DataFrame.interpolate() with method='linear'

Interpolation estimates missing values from their neighbors. Linear interpolation assumes a straight line between the known points. With irregular timestamps, method='index' uses the time index as the x-axis. NaN means not a number.

What NVIDIA says (3)

“Parameters : method str, default ‘linear’ Interpolation technique to use.”

— cuDF API: DataFrame.interpolate

“Returns the same object type as the caller, interpolated at some or all NaN values”

— cuDF API: DataFrame.interpolate

“‘index’, ‘values’: linearly interpolate using the index as an x-axis.”

— cuDF API: DataFrame.interpolate

Practice 7.2 (2 questions) Full Advance Data Structures guide

← 7.1 Time series splits and forecast evaluation · 7.3 CPU versus GPU for temporal analytics →