From the course: pandas Essential Training

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Using String methods

Using String methods

- [Instructor] If you want to work with lots of text data, one of the skills you'll need to pick up really quickly is cleaning and transforming text data. The pandas str methods are perfect for this. If you take a look at the athlete names in our dataset, the surname is in capitals followed by the first name. So I can use the str methods in pandas to change that. And so I can go ahead and change all of the athlete names to lowercase, and you can see that it's done that for the entire column. And I can do exactly the same thing for the events. So I could go ahead and take all of the events and you can see that some of the events are lower case at the start and some of them have uppercase. So if I wanted it to be a little bit more consistent, I can ensure that the first letter is capitalized and I can use the str.capitalize for that. And if I go ahead and take a look at all of the values now, so if I go ahead and do a unique here, you can see that the first character has been…

Contents