From a9caa79af1f6170cba29d9f8b569909d0d48e48c Mon Sep 17 00:00:00 2001 From: Kiril Isakov Date: Sun, 27 Apr 2025 19:29:27 +0200 Subject: [PATCH 1/2] edit definitions of some parameters with correct idiomatic English for better legibility (e.g. you don't *append* a prefix, you can only *prepend* it) --- pandas/core/reshape/encoding.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pandas/core/reshape/encoding.py b/pandas/core/reshape/encoding.py index 54704b274b74f..cac9de6d23338 100644 --- a/pandas/core/reshape/encoding.py +++ b/pandas/core/reshape/encoding.py @@ -60,13 +60,15 @@ def get_dummies( data : array-like, Series, or DataFrame Data of which to get dummy indicators. prefix : str, list of str, or dict of str, default None - String to append DataFrame column names. + A string to be prepended to DataFrame column names. Pass a list with length equal to the number of columns when calling get_dummies on a DataFrame. Alternatively, `prefix` can be a dictionary mapping column names to prefixes. - prefix_sep : str, default '_' - If appending prefix, separator/delimiter to use. Or pass a - list or dictionary as with `prefix`. + prefix_sep : str, list of str, or dict of str, default '_' + Should you choose to prepend DataFrame column names with a prefix, this + is the separator/delimiter to use between the two. Alternatively, + `prefix_sep` can be a list with length equal to the number of columns, + or a dictionary mapping column names to separators. dummy_na : bool, default False If True, a NaN indicator column will be added even if no NaN values are present. If False, NA values are encoded as all zero. From aaf21ebdbd83fe19740d36591de807c22723759d Mon Sep 17 00:00:00 2001 From: Kiril Isakov Date: Sun, 27 Apr 2025 23:29:10 +0200 Subject: [PATCH 2/2] strip trailing space, as suggested by @mroeschke Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> --- pandas/core/reshape/encoding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/reshape/encoding.py b/pandas/core/reshape/encoding.py index cac9de6d23338..ad4a5db441b89 100644 --- a/pandas/core/reshape/encoding.py +++ b/pandas/core/reshape/encoding.py @@ -66,7 +66,7 @@ def get_dummies( can be a dictionary mapping column names to prefixes. prefix_sep : str, list of str, or dict of str, default '_' Should you choose to prepend DataFrame column names with a prefix, this - is the separator/delimiter to use between the two. Alternatively, + is the separator/delimiter to use between the two. Alternatively, `prefix_sep` can be a list with length equal to the number of columns, or a dictionary mapping column names to separators. dummy_na : bool, default False