pandas.from_dummies

pandas 3.1.1 · General functions · function

Rebuild categorical columns from dummy indicator columns.

Call syntax

pd.from_dummies(data, sep=None, default_category=None)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
data Required
Positional or keyword
DataFrame

Provide the input data read, transformed, or stored by this call.

sep Optional
Positional or keyword
Default None
str

Specify the separator between fields or string pieces.

default_category Optional
Positional or keyword
Default None
None, Hashable or dict of Hashables

Returns

DataFrame