String Methods
The .str accessor applies string methods to a column.
Example
s = pd.Series([" Ada ", "kofi", "AMINA"])
print(s.str.strip().str.title().tolist())
print(s.str.contains("a", case=False).tolist())
print(s.str.len().tolist())Result
['Ada', 'Kofi', 'Amina'] [True, False, True] [6, 4, 5]
Exercise
Lower case.
s.str.()
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.