liveBook · Manning

Str.get_dummies

As explained in Pandas Workout: 200 exercises to make you a stronger data analyst

A pandas string-accessor operation that converts delimiter-separated categorical values into binary indicator columns.

str.get_dummies converts delimiter-separated categorical values into binary indicator columns. A value such as “JavaScript;Python” becomes separate JavaScript and Python columns containing 1 or 0. section 9.10

Turn languages into analyzable columns

For a survey column named LanguageHaveWorkedWith, use df['LanguageHaveWorkedWith'].str.get_dummies(sep=';'). Combine the result with the original data using pd.concat(..., axis='columns'), then filter the indicator columns to compare salaries for specific language combinations.

How Pandas Workout: 200 exercises to make you a stronger data analyst covers it

How deep it goes
Demonstrates the operation, horizontal concatenation, and downstream boolean filtering, without detailing implementation internals.
Examples
Uses Stack Overflow survey language responses and salary comparisons across Python, JavaScript, and Java combinations.
What it assumes
Assumes familiarity with pandas Series, DataFrames, boolean indexing, and pd.concat.
What you can do after
Apply pandas string accessors and concatenation to analyze combinations of categorical values.
How it connects
Connects string splitting, dummy columns, DataFrame concatenation, boolean indexing, and aggregation.

Also explained in

Compare how 2 books explain str.get_dummies →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pandas Workout: 200 exercises to make you a stronger data analyst. The section links point to the parts of the book it draws on.