From 9fbce83c0d5087eb1d06df856cc245798d52e133 Mon Sep 17 00:00:00 2001 From: Pacific <12509045+pacificdragon@users.noreply.github.com> Date: Sun, 5 Feb 2023 23:57:43 +0530 Subject: [PATCH] Removed **kwds from parse function to handle unexpected arguments --- doc/source/whatsnew/v2.0.0.rst | 1 + pandas/io/excel/_base.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/source/whatsnew/v2.0.0.rst b/doc/source/whatsnew/v2.0.0.rst index 1bfe9f50efbc8..efd094d1a4871 100644 --- a/doc/source/whatsnew/v2.0.0.rst +++ b/doc/source/whatsnew/v2.0.0.rst @@ -1249,6 +1249,7 @@ I/O - Bug in :meth:`DataFrame.to_dict` not converting ``NA`` to ``None`` (:issue:`50795`) - Bug in :meth:`DataFrame.to_json` where it would segfault when failing to encode a string (:issue:`50307`) - Bug in :func:`read_xml` where file-like objects failed when iterparse is used (:issue:`50641`) +- Bug in :func:`read_excel` where passing invalid argument name ``headers`` to :meth:`parse` doesn't raise error (:issue:`50953`) Period ^^^^^^ diff --git a/pandas/io/excel/_base.py b/pandas/io/excel/_base.py index 2a0d3a01d3383..b35c6d3b4a4c4 100644 --- a/pandas/io/excel/_base.py +++ b/pandas/io/excel/_base.py @@ -1538,13 +1538,16 @@ def parse( skiprows: Sequence[int] | int | Callable[[int], object] | None = None, nrows: int | None = None, na_values=None, + keep_default_na: bool = True, + na_filter: bool = True, + verbose: bool = False, parse_dates: list | dict | bool = False, date_parser: Callable | None = None, thousands: str | None = None, comment: str | None = None, + decimal: str = ".", skipfooter: int = 0, - use_nullable_dtypes: bool = False, - **kwds, + use_nullable_dtypes: bool = False ) -> DataFrame | dict[str, DataFrame] | dict[int, DataFrame]: """ Parse specified sheet(s) into a DataFrame. @@ -1570,13 +1573,16 @@ def parse( skiprows=skiprows, nrows=nrows, na_values=na_values, + keep_default_na=keep_default_na, + na_filter=na_filter, + verbose=verbose, parse_dates=parse_dates, date_parser=date_parser, thousands=thousands, + decimal=decimal, comment=comment, skipfooter=skipfooter, - use_nullable_dtypes=use_nullable_dtypes, - **kwds, + use_nullable_dtypes=use_nullable_dtypes ) @property