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
From the course: pandas Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Get an overview of the data and displaying it8m 23s
-
(Locked)
Select a Series (column)4m 51s
-
(Locked)
Challenge: Fundamentals55s
-
(Locked)
Solution: Fundamentals6m 16s
-
(Locked)
Python lists and dictionaries2m 2s
-
(Locked)
Rename a Series (or column)5m 56s
-
(Locked)
Remove a Series (column) or row8m 39s
-
(Locked)
Filtering rows for a single condition3m 46s
-
(Locked)
Filter rows for multiple conditions4m 6s
-
(Locked)
Using String methods4m 32s
-
(Locked)
Sorting a DataFrame or Series4m 18s
-
-
-
-
-