From 85dd62cf05e5e73e6543c699b740b76f25ad24c1 Mon Sep 17 00:00:00 2001 From: saldanhad Date: Tue, 8 Oct 2024 03:14:15 +0530 Subject: [PATCH 1/2] update docstring for dummy_na parameter --- pandas/core/reshape/encoding.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/core/reshape/encoding.py b/pandas/core/reshape/encoding.py index c397c1c2566a5..3d099a65c606d 100644 --- a/pandas/core/reshape/encoding.py +++ b/pandas/core/reshape/encoding.py @@ -68,7 +68,9 @@ def get_dummies( If appending prefix, separator/delimiter to use. Or pass a list or dictionary as with `prefix`. dummy_na : bool, default False - Add a column to indicate NaNs, if False NaNs are ignored. + If True, a NaN indicator column will be added even if no NaN values are present. + This behavior is intentional and by design. If False, NA values are encoded + as all zero. columns : list-like, default None Column names in the DataFrame to be encoded. If `columns` is None then all the columns with From 2b3d363f421ff80bcd5fb1b3f0f67ce8476f4d59 Mon Sep 17 00:00:00 2001 From: Deepak Saldanha Date: Tue, 8 Oct 2024 06:24:00 +0530 Subject: [PATCH 2/2] Update pandas/core/reshape/encoding.py Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> --- pandas/core/reshape/encoding.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/core/reshape/encoding.py b/pandas/core/reshape/encoding.py index 3d099a65c606d..33ff182f5baee 100644 --- a/pandas/core/reshape/encoding.py +++ b/pandas/core/reshape/encoding.py @@ -69,8 +69,7 @@ def get_dummies( list or dictionary as with `prefix`. dummy_na : bool, default False If True, a NaN indicator column will be added even if no NaN values are present. - This behavior is intentional and by design. If False, NA values are encoded - as all zero. + If False, NA values are encoded as all zero. columns : list-like, default None Column names in the DataFrame to be encoded. If `columns` is None then all the columns with