Textual data includes usernames, product names, sales regions, business units, ticker symbols, and company names. It may drive analysis, prepare data for text-based machine learning, or describe and categorize numerical records. section 9.0
Pandas stores text using Python string objects or its pandas-specific string class rather than NumPy character arrays. The str accessor exposes string methods on each Series and returns a new Series that can replace, supplement, or form a new column. section 9.0
Common text operations turn written values into analytical signals:
- Measure values with str.len(), test character content with str.isdigit(), and locate matching text with str.contains(). section 9.0
Filter words by their contents
For s = Series('this is a test 123 456'.split()), s.str.len() returns each word's length, while s.loc[s.str.isdigit()] selects 123 and 456. A pattern such as s.str.contains('[ae]') produces a Boolean mask for words containing either a or e.


