From the course: Advanced Pandas

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Working with strings using pandas

Working with strings using pandas

From the course: Advanced Pandas

Start my 1-month free trial

Working with strings using pandas

- [Instructor] Text data can be an incredibly rich source of data for analysis and Pandas is a well-equipped for working with, cleaning, and processing text data in string format. Let's dive into some useful methods. For this lesson, we'll start with a series of three names, organized last, first and you might notice some inconsistencies in how these names are stored. In Pandas, the string accessor denoted by .str enables a host of useful string transformations. Let's start by replacing that semi-colon. Great, you can see the replace function easily replaced the semi-colon with the comma. Now another string operator that can be useful is calling the length in the number of characters of each string in your series. Great, so we see the first two names have 14 characters a piece and the third name has 10 characters. Now, I noticed some trailing and leading spaces in the names, so this is a great opportunity to use strip…

Contents