DOC: complete documentation for pd.get_dummies (#48466) (#48467) · pandas-dev/pandas@047c11d (original) (raw)

Original file line number Diff line number Diff line change
@@ -35,6 +35,10 @@ def get_dummies(
35 35 """
36 36 Convert categorical variable into dummy/indicator variables.
37 37
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 +
38 42 Parameters
39 43 ----------
40 44 data : array-like, Series, or DataFrame
@@ -65,11 +69,12 @@ def get_dummies(
65 69 Returns
66 70 -------
67 71 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.
69 74
70 75 See Also
71 76 --------
72 - Series.str.get_dummies : Convert Series to dummy codes.
77 + Series.str.get_dummies : Convert Series of strings to dummy codes.
73 78 :func:`~pandas.from_dummies` : Convert dummy codes to categorical ``DataFrame``.
74 79
75 80 Notes