Use explode when one cell contains several values and the analysis needs one value per row. It expands each list-like item into its own row while retaining the original index labels. section 9.10
Split programming languages into rows
A semicolon-separated survey response can become an analyzable Series with a short method chain: `df['LanguageHaveWorkedWith'].str.split(';').explode()` Each respondent’s languages now occupy separate rows, so `value_counts().head(10)` can identify the most frequently mentioned languages. The same pattern supports comparing languages people have used with languages they want to learn. section 9.10
Turn descriptions into words
For wine descriptions, lowercase the text, split on whitespace, and explode the resulting lists: `words = s.str.lower().str.split().explode()` Continue by stripping punctuation, filtering short words and common terms, then counting the remaining values. Encapsulating this chain in `top_10_words` makes it reusable for countries, provinces, and wine varieties. section 9.6
After expansion, combine the resulting Series with familiar pandas operations:
- Count repeated values with `value_counts`. section 9.10
- Join expanded values back to columns such as `Country`, then group and aggregate them. section 9.10
- Compare expanded categories with `isin` and boolean indexing. section 9.10
(
df['LanguageHaveWorkedWith']
.str.split(';')
.explode()
)
Inspect the minimal split-and-explode transformation from semicolon-separated survey responses. section 9.10
