pola-rs/polars · error · NotImplementedError

functionality for `nan_as_null` has not been implemented…

Error message

functionality for `nan_as_null` has not been implemented and the parameter will be removed in a future version\n\nUse the default `nan_as_null=False`.

What it means

Raised when constructing the interchange PolarsDataFrame with nan_as_null=True. The parameter is accepted for API compatibility but the NaN-to-null conversion was never implemented; only the default nan_as_null=False is valid, and setting True always raises NotImplementedError. Rewrite the data with fill_nan(Null) before conversion if needed.

Solutions

  1. Remove the nan_as_null argument or set nan_as_null=False; the nan_as_null=True behavior is unimplemented and the parameter is deprecated.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at py-polars/src/polars/interchange/dataframe.py:64 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19). Data as JSON: /api/errors/38fc33ceac16f3f3. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/interchange/dataframe.py:64

        ----------
        nan_as_null
            Overwrite null values in the data with `NaN`.

            .. warning::
                This functionality has not been implemented and the parameter will be
                removed in a future version.
                Setting this to `True` will raise a `NotImplementedError`.
        allow_copy
            Allow memory to be copied to perform the conversion. If set to `False`,
            causes conversions that are not zero-copy to fail.
        """
        if nan_as_null:
            msg = (
                "functionality for `nan_as_null` has not been implemented and the"
                " parameter will be removed in a future version"
                "\n\nUse the default `nan_as_null=False`."
            )
            raise NotImplementedError(msg)
        return PolarsDataFrame(self._df, allow_copy=allow_copy)

    @property
    def metadata(self) -> dict[str, Any]:
        """The metadata for the dataframe."""
        return {}

    def num_columns(self) -> int:
        """Return the number of columns in the dataframe."""
        return self._df.width

    def num_rows(self) -> int:
        """Return the number of rows in the dataframe."""
        return self._df.height

    def num_chunks(self) -> int:
        """
        Return the number of chunks the dataframe consists of.

View on GitHub (pinned to 9b5d73fd00)