Cleaning Data with Strip in pandas


If we have a DataFrame that has a column of data the looks messy, strip() might work for us.

strip() will work on the beginning and end of the text, not in the middle. By default, strip will remove white space at the beginning and the end of text. This is similar to Excel’s TRIM() function. We also have the lstrip() function for left strip, and rstrip() for right strip. These refer to the left and right side of the string.

Leave a Reply