Text with .str

The .str accessor applies string operations to a whole column: lower, strip, contains, replace, split, extract. It handles missing values without error and accepts regular expressions. It is used for cleaning and extracting information from text.

Example

df['nom'] = df['nom'].str.strip().str.title()

Related concepts

The whole glossary