Skip to content

Commit 047c11d

Browse files
authored
DOC: complete documentation for pd.get_dummies (#48466) (#48467)
1 parent 5bcf4d5 commit 047c11d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pandas/core/reshape/encoding.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ def get_dummies(
3535
"""
3636
Convert categorical variable into dummy/indicator variables.
3737
38+
Each variable is converted in as many 0/1 variables as there are different
39+
values. Columns in the output are each named after a value; if the input is
40+
a DataFrame, the name of the original variable is prepended to the value.
41+
3842
Parameters
3943
----------
4044
data : array-like, Series, or DataFrame
@@ -65,11 +69,12 @@ def get_dummies(
6569
Returns
6670
-------
6771
DataFrame
68-
Dummy-coded data.
72+
Dummy-coded data. If `data` contains other columns than the
73+
dummy-coded one(s), these will be prepended, unaltered, to the result.
6974
7075
See Also
7176
--------
72-
Series.str.get_dummies : Convert Series to dummy codes.
77+
Series.str.get_dummies : Convert Series of strings to dummy codes.
7378
:func:`~pandas.from_dummies` : Convert dummy codes to categorical ``DataFrame``.
7479
7580
Notes

0 commit comments

Comments
 (0)