liveBook · Manning

Str.get_dummies

As explained in The Well-Grounded Data Analyst

str.get_dummies is a pandas string method that expands delimited categorical values into binary indicator columns.

Use pandas `str.get_dummies` when one string field stores multiple categorical selections in a delimiter-separated value. It expands each distinct selection into a binary indicator column. section 6.4.2

Split multiple survey selections

For AI-tool survey responses, filter users first, then split semicolon-delimited answers: `ai_tool_indicators = survey.loc[survey["AISelect"] == "Yes", "AIToolCurrently Using"].str.get_dummies(sep=";")`. If labels contain spaces after splitting, clean them with `ai_tool_indicators.columns = [c.strip() for c in ai_tool_indicators.columns]`. Column sums count selections; column means estimate the percentage selecting each option. section 6.4.2

How The Well-Grounded Data Analyst covers it

How deep it goes
Provides working pandas code and downstream aggregation, but does not explain the method’s internal implementation.
Examples
Uses semicolon-delimited AI-tool survey answers, cleaned indicator names, percentage bars, and comparisons by sentiment, trust, and job role.
What it assumes
Assumes a pandas DataFrame with a string column containing consistently delimited values and basic column-selection familiarity.
What you can do after
Apply it via pandas to create binary columns from multi-value string fields and summarize selections.
How it connects
Connects string splitting with categorical data, indicator variables, grouping, crosstabs, and heatmaps.

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 The Well-Grounded Data Analyst. The section links point to the parts of the book it draws on.