Skip to content

Commit 8ab9859

Browse files
committed
DOC: add get_dummies dtype argument description to reshaping.rst
1 parent f39f015 commit 8ab9859

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

doc/source/reshaping.rst

+11
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,17 @@ When a column contains only one level, it will be omitted in the result.
634634
635635
pd.get_dummies(df, drop_first=True)
636636
637+
By default new columns will have ``np.uint8`` dtype. To choose another dtype use ``dtype`` argument:
638+
639+
.. ipython:: python
640+
641+
df = pd.DataFrame({'A': list('abc'), 'B': [1.1, 2.2, 3.3]})
642+
643+
pd.get_dummies(df, dtype=bool).dtypes
644+
645+
.. versionadded:: 0.22.0
646+
647+
637648
.. _reshaping.factorize:
638649

639650
Factorizing values

pandas/core/reshape/reshape.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ def get_dummies(data, prefix=None, prefix_sep='_', dummy_na=False,
729729
.. versionadded:: 0.18.0
730730
731731
dtype : dtype, default np.uint8
732-
Data type to force on a new columns. Only a single dtype is allowed.
732+
Data type for new columns. Only a single dtype is allowed.
733733
734734
.. versionadded:: 0.22.0
735735

0 commit comments

Comments
 (0)