From 1270d21b8ae043a63af2d9dc57092bc94e4c23da Mon Sep 17 00:00:00 2001 From: rajatsmukherjee Date: Thu, 17 Aug 2023 13:36:13 +0530 Subject: [PATCH 1/3] added nonkeyword deprecation --- pandas/core/generic.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 7624c8f7c7930..88fa32ca5b20b 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -3017,6 +3017,9 @@ def to_sql( ) @final + @deprecate_nonkeyword_arguments( + version=None, allowed_args=["self", "path"], name="to_pickle" + ) @doc( storage_options=_shared_docs["storage_options"], compression_options=_shared_docs["compression_options"] % "path", From 5291bd4edb35a2a1bbb2ceed059faf8ec69b9eb0 Mon Sep 17 00:00:00 2001 From: rajatsmukherjee Date: Thu, 17 Aug 2023 13:52:42 +0530 Subject: [PATCH 2/3] added keyword deprecation --- pandas/core/frame.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 797b2f4ddb45e..211c0b65046a2 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -64,6 +64,7 @@ from pandas.util._decorators import ( Appender, Substitution, + deprecate_nonkeyword_arguments, doc, ) from pandas.util._exceptions import find_stack_level @@ -1229,6 +1230,9 @@ def to_string( ) -> None: ... + @deprecate_nonkeyword_arguments( + version=None, allowed_args=["self", "buf"], name="to_string" + ) @Substitution( header_type="bool or list of str", header="Write out the column names. If a list of columns " From 3bbb22eaa85feb60844825f4a29d705edcba50d2 Mon Sep 17 00:00:00 2001 From: rajatsmukherjee Date: Thu, 17 Aug 2023 14:15:11 +0530 Subject: [PATCH 3/3] added whatsnew --- doc/source/whatsnew/v2.2.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v2.2.0.rst b/doc/source/whatsnew/v2.2.0.rst index c35473b852eb9..92c3f4aa45861 100644 --- a/doc/source/whatsnew/v2.2.0.rst +++ b/doc/source/whatsnew/v2.2.0.rst @@ -92,7 +92,7 @@ Other API changes Deprecations ~~~~~~~~~~~~ -- +- Deprecated allowing non-keyword arguments in :meth:`DataFrame.to_string` except ``buf``. (:issue:`54229`) - .. ---------------------------------------------------------------------------