8. Strings and Text Data
8.1 Introduction
Most data in the world can be stored as text and strings. Even values that may eventually be numeric data may initially come in the form of text. It’s important to be able to work with text data. This chapter won’t be specific to Pandas; that is, we will mainly explore how you manipulate strings within Python without Pandas. The following chapters will cover some more Pandas materials. Then we will come back to strings and see how it all ties back with Pandas. As an aside, some of the string examples in this chapter come from Monty Python and the Holy Grail.
Objectives
This chapter will cover:
1. Subsetting strings
2. String methods
3. String formatting
4. Regular expressions
8.2 Strings
In Python, ...
Get Pandas for Everyone: Python Data Analysis, First Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.