Skip to content

Commit 3b0318f

Browse files
phoflpmhatre1
authored andcommitted
Remove use_nullable_dtypes from read_parquet (pandas-dev#57370)
1 parent dcc370b commit 3b0318f

File tree

3 files changed

+1
-46
lines changed

3 files changed

+1
-46
lines changed

doc/source/whatsnew/v3.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ Removal of prior version deprecations/changes
122122
- Removed ``pandas.io.sql.execute`` (:issue:`50185`)
123123
- Removed ``pandas.value_counts``, use :meth:`Series.value_counts` instead (:issue:`53493`)
124124
- Removed ``read_gbq`` and ``DataFrame.to_gbq``. Use ``pandas_gbq.read_gbq`` and ``pandas_gbq.to_gbq`` instead https://pandas-gbq.readthedocs.io/en/latest/api.html (:issue:`55525`)
125+
- Removed ``use_nullable_dtypes`` from :func:`read_parquet` (:issue:`51853`)
125126
- Removed deprecated argument ``obj`` in :meth:`.DataFrameGroupBy.get_group` and :meth:`.SeriesGroupBy.get_group` (:issue:`53545`)
126127
- Removed deprecated behavior of :meth:`Series.agg` using :meth:`Series.apply` (:issue:`53325`)
127128
- Removed the ``ArrayManager`` (:issue:`55043`)

pandas/io/parquet.py

-35
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
Any,
1010
Literal,
1111
)
12-
import warnings
1312
from warnings import catch_warnings
1413

1514
from pandas._config import using_pyarrow_string_dtype
@@ -18,7 +17,6 @@
1817
from pandas.compat._optional import import_optional_dependency
1918
from pandas.errors import AbstractMethodError
2019
from pandas.util._decorators import doc
21-
from pandas.util._exceptions import find_stack_level
2220
from pandas.util._validators import check_dtype_backend
2321

2422
import pandas as pd
@@ -240,7 +238,6 @@ def read(
240238
path,
241239
columns=None,
242240
filters=None,
243-
use_nullable_dtypes: bool = False,
244241
dtype_backend: DtypeBackend | lib.NoDefault = lib.no_default,
245242
storage_options: StorageOptions | None = None,
246243
filesystem=None,
@@ -357,15 +354,9 @@ def read(
357354
**kwargs,
358355
) -> DataFrame:
359356
parquet_kwargs: dict[str, Any] = {}
360-
use_nullable_dtypes = kwargs.pop("use_nullable_dtypes", False)
361357
dtype_backend = kwargs.pop("dtype_backend", lib.no_default)
362358
# We are disabling nullable dtypes for fastparquet pending discussion
363359
parquet_kwargs["pandas_nulls"] = False
364-
if use_nullable_dtypes:
365-
raise ValueError(
366-
"The 'use_nullable_dtypes' argument is not supported for the "
367-
"fastparquet engine"
368-
)
369360
if dtype_backend is not lib.no_default:
370361
raise ValueError(
371362
"The 'dtype_backend' argument is not supported for the "
@@ -493,7 +484,6 @@ def read_parquet(
493484
engine: str = "auto",
494485
columns: list[str] | None = None,
495486
storage_options: StorageOptions | None = None,
496-
use_nullable_dtypes: bool | lib.NoDefault = lib.no_default,
497487
dtype_backend: DtypeBackend | lib.NoDefault = lib.no_default,
498488
filesystem: Any = None,
499489
filters: list[tuple] | list[list[tuple]] | None = None,
@@ -534,17 +524,6 @@ def read_parquet(
534524
535525
.. versionadded:: 1.3.0
536526
537-
use_nullable_dtypes : bool, default False
538-
If True, use dtypes that use ``pd.NA`` as missing value indicator
539-
for the resulting DataFrame. (only applicable for the ``pyarrow``
540-
engine)
541-
As new dtypes are added that support ``pd.NA`` in the future, the
542-
output with this option will change to use those dtypes.
543-
Note: this is an experimental option, and behaviour (e.g. additional
544-
support dtypes) may change without notice.
545-
546-
.. deprecated:: 2.0
547-
548527
dtype_backend : {{'numpy_nullable', 'pyarrow'}}, default 'numpy_nullable'
549528
Back-end data type applied to the resultant :class:`DataFrame`
550529
(still experimental). Behaviour is as follows:
@@ -643,27 +622,13 @@ def read_parquet(
643622
"""
644623

645624
impl = get_engine(engine)
646-
647-
if use_nullable_dtypes is not lib.no_default:
648-
msg = (
649-
"The argument 'use_nullable_dtypes' is deprecated and will be removed "
650-
"in a future version."
651-
)
652-
if use_nullable_dtypes is True:
653-
msg += (
654-
"Use dtype_backend='numpy_nullable' instead of use_nullable_dtype=True."
655-
)
656-
warnings.warn(msg, FutureWarning, stacklevel=find_stack_level())
657-
else:
658-
use_nullable_dtypes = False
659625
check_dtype_backend(dtype_backend)
660626

661627
return impl.read(
662628
path,
663629
columns=columns,
664630
filters=filters,
665631
storage_options=storage_options,
666-
use_nullable_dtypes=use_nullable_dtypes,
667632
dtype_backend=dtype_backend,
668633
filesystem=filesystem,
669634
**kwargs,

pandas/tests/io/test_parquet.py

-11
Original file line numberDiff line numberDiff line change
@@ -1273,17 +1273,6 @@ def test_timezone_aware_index(self, fp, timezone_aware_date_list):
12731273
expected.index.name = "index"
12741274
check_round_trip(df, fp, expected=expected)
12751275

1276-
def test_use_nullable_dtypes_not_supported(self, fp):
1277-
df = pd.DataFrame({"a": [1, 2]})
1278-
1279-
with tm.ensure_clean() as path:
1280-
df.to_parquet(path)
1281-
with pytest.raises(ValueError, match="not supported for the fastparquet"):
1282-
with tm.assert_produces_warning(FutureWarning):
1283-
read_parquet(path, engine="fastparquet", use_nullable_dtypes=True)
1284-
with pytest.raises(ValueError, match="not supported for the fastparquet"):
1285-
read_parquet(path, engine="fastparquet", dtype_backend="pyarrow")
1286-
12871276
def test_close_file_handle_on_read_error(self):
12881277
with tm.ensure_clean("test.parquet") as path:
12891278
pathlib.Path(path).write_bytes(b"breakit")

0 commit comments

Comments
 (0)