Replacing parts of a column's values

We can also change our data using string methods. Here, we replace the spaces in the RegionName column from our dataset with no space, using the replace method:

data.RegionName.str.replace(' ', '').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.