String Operations in Pandas
Text data needs cleaning - fixing case, removing whitespace, extracting parts. Pandas provides string methods through .str.
Convert case:
df['name'].str.lower()
df['name'].str.upper()
df['name'].str.title()
Strip whitespace:
df['email'].str.strip()
Check for substrings:
df['email'].str.contains('gmail')
Replace text:
df['phone'].str.replace('-', '')
All standard Python string methods are available through .str, applied element-wise to the entire column.
I cover text processing in my Pandas course.