From 7ce44f0ba7ee08495cd5fc3c4cdfde8b6bd30231 Mon Sep 17 00:00:00 2001 From: Huanghz2001 <83120995+Huanghz2001@users.noreply.github.com> Date: Fri, 5 Jan 2024 12:03:45 +0000 Subject: [PATCH 1/2] 'Modified docstring of Dataframe.to_dict() to make the usage orient='records' moreclear --- pandas/core/frame.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 6851955d693bc..d70197bb98c31 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2066,7 +2066,9 @@ def to_dict( index : bool, default True Whether to include the index item (and index_names item if `orient` is 'tight') in the returned dictionary. Can only be ``False`` - when `orient` is 'split' or 'tight'. + when `orient` is 'split' or 'tight'. Note that when `orient` is + 'records', this parameter does not take effect (index item always + not included). .. versionadded:: 2.0.0 From e8d9aa68a41f87a73281dc698ac53a9593992638 Mon Sep 17 00:00:00 2001 From: Huanghz2001 <83120995+Huanghz2001@users.noreply.github.com> Date: Fri, 5 Jan 2024 12:38:13 +0000 Subject: [PATCH 2/2] Changed by pre-commit --- pandas/core/frame.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index d70197bb98c31..8db437ccec389 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2066,8 +2066,8 @@ def to_dict( index : bool, default True Whether to include the index item (and index_names item if `orient` is 'tight') in the returned dictionary. Can only be ``False`` - when `orient` is 'split' or 'tight'. Note that when `orient` is - 'records', this parameter does not take effect (index item always + when `orient` is 'split' or 'tight'. Note that when `orient` is + 'records', this parameter does not take effect (index item always not included). .. versionadded:: 2.0.0