Skip to content

DOC: Highlight dtype_backend with note #51037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pandas/core/tools/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ def to_numeric(
set to True, nullable dtypes are used for all dtypes that have a nullable
implementation, even if no nulls are present.
.. note::
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. versionadded:: 2.0.0
Returns
-------
ret
Expand Down
16 changes: 9 additions & 7 deletions pandas/io/clipboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ def read_clipboard(
set to True, nullable dtypes are used for all dtypes that have a nullable
implementation, even if no nulls are present.
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
This is only implemented for the ``python``
engine.
.. note::
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
This is only implemented for the ``python``
engine.
.. versionadded:: 2.0
Expand Down
8 changes: 8 additions & 0 deletions pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@
set to True, nullable dtypes are used for all dtypes that have a nullable
implementation, even if no nulls are present. Dtype takes precedence if given.
.. note::
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. versionadded:: 2.0
Returns
Expand Down
12 changes: 7 additions & 5 deletions pandas/io/feather_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ def read_feather(
set to True, nullable dtypes are used for all dtypes that have a nullable
implementation, even if no nulls are present.
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. note::
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. versionadded:: 2.0
Expand Down
12 changes: 7 additions & 5 deletions pandas/io/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,11 +1145,13 @@ def read_html(
set to True, nullable dtypes are used for all dtypes that have a nullable
implementation, even if no nulls are present.
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. note::
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. versionadded:: 2.0
Expand Down
12 changes: 7 additions & 5 deletions pandas/io/json/_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,11 +643,13 @@ def read_json(
set to True, nullable dtypes are used for all dtypes that have a nullable
implementation, even if no nulls are present.
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. note::
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. versionadded:: 2.0
Expand Down
21 changes: 10 additions & 11 deletions pandas/io/orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,19 @@ def read_orc(
This mirrors the original behaviour of
:external+pyarrow:py:meth:`pyarrow.orc.ORCFile.read`.
use_nullable_dtypes : bool, default False
If True, use dtypes that use ``pd.NA`` as missing value indicator
for the resulting DataFrame.
Whether or not to use nullable dtypes as default when reading data. If
set to True, nullable dtypes are used for all dtypes that have a nullable
implementation, even if no nulls are present.
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. note::
.. versionadded:: 2.0.0
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. note
Currently only ``mode.dtype_backend`` set to ``"pyarrow"`` is supported.
.. versionadded:: 2.0
**kwargs
Any additional kwargs are passed to pyarrow.
Expand Down
14 changes: 8 additions & 6 deletions pandas/io/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,15 @@ def read_parquet(
.. versionadded:: 1.2.0
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. note::
.. versionadded:: 2.0.0
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. versionadded:: 2.0.0
**kwargs
Any additional kwargs are passed to the engine.
Expand Down
26 changes: 19 additions & 7 deletions pandas/io/parsers/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,15 @@
set to True, nullable dtypes are used for all dtypes that have a nullable
implementation, even if no nulls are present.

The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
This is only implemented for the ``pyarrow`` or ``python``
engines.
.. note::

The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
This is only implemented for the ``pyarrow`` or ``python``
engines.

.. versionadded:: 2.0

Expand Down Expand Up @@ -1271,6 +1273,16 @@ def read_fwf(
set to True, nullable dtypes are used for all dtypes that have a nullable
implementation, even if no nulls are present.

.. note::

The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
This is only implemented for the ``pyarrow`` or ``python``
engines.

.. versionadded:: 2.0

**kwds : optional
Expand Down
12 changes: 7 additions & 5 deletions pandas/io/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,11 +988,13 @@ def read_xml(
set to True, nullable dtypes are used for all dtypes that have a nullable
implementation, even if no nulls are present.
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. note::
The nullable dtype implementation can be configured by calling
``pd.set_option("mode.dtype_backend", "pandas")`` to use
numpy-backed nullable dtypes or
``pd.set_option("mode.dtype_backend", "pyarrow")`` to use
pyarrow-backed nullable dtypes (using ``pd.ArrowDtype``).
.. versionadded:: 2.0
Expand Down