Removing white spaces

We can also do some data cleaning using string methods. For example, here, we use the lstrip method to remove all leading white spaces from the values of a column:

data.RegionName.str.lstrip().head() 

The following is the output:

Get Mastering Exploratory Analysis with pandas now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.