pandas.Series.str.get_dummies
pandas 3.1.1 · Series and accessors · method
Split each string into tokens and build a separate indicator column for each token.
Call syntax
Series.str.get_dummies(sep='|', dtype=None)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
sep |
Optional Positional or keyword Default '|' |
str Specify the separator between fields or string pieces. |
dtype |
Optional Positional or keyword Default None |
dtype Choose the data type for the input conversion or result. |
Returns
DataFrame