﻿# cuDF null and NaN: preserve the missing-value policy when exporting to pandas

Define cuDF nan_as_null construction and pandas nullable export deliberately so missing feature values do not silently change representation or meaning.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-cudf-null-nan-export-policy/
Language: en

## Describe the missing feature before constructing a column

A sensor dataset distinguishes an unavailable reading from an invalid numerical result. Both may appear as missing-looking cells in a printed table, but the intended feature semantics differ. The [cuDF missing-data guide](https://docs.nvidia.com/cudf/latest/cudf/missing-data/) describes null handling and NaN behavior. Decide whether those cases should remain distinct for the model before converting input values into a GPU column. A display representation is not a complete schema.

## Choose the constructor policy explicitly

The [Series constructor reference](https://docs.nvidia.com/cudf/26.10/cudf/api_docs/api/cudf.Series/) documents `nan_as_null`, including conversion of NaN payloads to nulls or preserving them. Record the chosen setting in the ingestion contract rather than assuming every source and constructor makes the same choice. Once distinctions have been deliberately collapsed, a later exporter cannot reconstruct the original reason for each missing value from the numeric column alone.

## Define the operations that consume missing values

A feature pipeline may fill, filter or aggregate missing entries. Specify which cases each operation should include and what an entirely unavailable group means. Do not replace every missing-looking value with an ordinary numerical default merely to satisfy an estimator input requirement. In the sensor scenario, that can turn unavailable evidence into a valid reading. Preserve a separate availability feature when the intended model needs that information, and explain its interpretation in the feature schema.

## Inspect the pandas representation at export

The [to_pandas reference](https://docs.nvidia.com/cudf/26.10/cudf/api_docs/api/cudf.Series.to_pandas/) distinguishes nullable output from ordinary pandas dtypes and documents conversion of nulls to NaN or None depending on type. A CPU consumer may therefore see a different dtype or marker after export. Check its missing-value handling explicitly. Do not infer that a column preserved every semantic distinction merely because its printed cells still look empty.

## Verify values and missingness together

Use a pilot containing ordinary readings, unavailable readings and preserved NaNs where the schema requires them. Compare the exported dtype, missingness and downstream feature calculation with the declared policy. The guides on [Arrow nullable features](/journal/data-guide-arrow-nullable-feature-contract/) and [logical table schemas](/journal/data-guide-frictionless-table-schema/) explain related representation concerns. A correct CPU-GPU handoff preserves the intended information about absent evidence as well as the values that happen to be present.
