# Splitting and Extracting Text

str.split with expand=True turns one text column into several, with n=1 to split at the first space only, and str.extract with the short regular expression (\\d+), read 'one or more digits, kept', pulls a number out of text typed in many different ways, where a plain replace would need a call for every wording.

![Cheat sheet: Splitting and Extracting Text](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/8a746c08a0eb4e88b2720aa6a725c706.webp)

- Category: Data Analysis
- Level: Journeyman
- Tags: python, Regular Expression (python), str.extract(), str.split()
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/pandas-split-and-extract-cheat-sheet
