From 61dcdf4db773235cc2c231406fa3c41d6839b55f Mon Sep 17 00:00:00 2001 From: RajatS Mukherjee Date: Thu, 31 Aug 2023 11:18:56 +0000 Subject: [PATCH 1/2] added deprecation for axis=1 --- pandas/core/shared_docs.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pandas/core/shared_docs.py b/pandas/core/shared_docs.py index 1fc63dd503467..30fbac55bc59e 100644 --- a/pandas/core/shared_docs.py +++ b/pandas/core/shared_docs.py @@ -113,6 +113,13 @@ axis : {0 or 'index', 1 or 'columns'}, default 0 Split along rows (0) or columns (1). For `Series` this parameter is unused and defaults to 0. + + .. deprecated:: 2.1.0 + + This now defaults to 0 for both `DataFrame` and `Series`. + DataFrame.groupby with axis=1 is deprecated. Do + Instead, do `frame.T.groupby(...)` without axis. + level : int, level name, or sequence of such, default None If the axis is a MultiIndex (hierarchical), group by a particular level or levels. Do not specify both ``by`` and ``level``. From e7d0a8a9a4d32d8f0257e24fcff59524f0b1db45 Mon Sep 17 00:00:00 2001 From: RajatS Mukherjee Date: Thu, 31 Aug 2023 17:46:08 +0000 Subject: [PATCH 2/2] suggested changes --- pandas/core/shared_docs.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pandas/core/shared_docs.py b/pandas/core/shared_docs.py index 30fbac55bc59e..9da103e13f691 100644 --- a/pandas/core/shared_docs.py +++ b/pandas/core/shared_docs.py @@ -116,9 +116,8 @@ .. deprecated:: 2.1.0 - This now defaults to 0 for both `DataFrame` and `Series`. - DataFrame.groupby with axis=1 is deprecated. Do - Instead, do `frame.T.groupby(...)` without axis. + Will be removed and behave like axis=0 in a future version. + For ``axis=1``, do ``frame.T.groupby(...)`` instead. level : int, level name, or sequence of such, default None If the axis is a MultiIndex (hierarchical), group by a particular