Removing Whitespace or Characters from a Dataframe Column

Python
Data Preprocessing

 1|  # remove whitespace from all strings in the Name column
 2|  df['Name'] = df['Name'].str.strip()
 3|  
 4|  # remove all commas from the Name column
 5|  df['Name'] = df['Name'].str.strip(",")
1 Upvote
Tags: Whitespace | Strip
Did you find this snippet useful?

Sign up to bookmark this in your snippet library

Normalize Windowed Time Series
Python
Data Preprocessing

Scaler | Normalize | Scale | Min-max

4
Pivoting Pandas Dataframes
Python
Data Preprocessing

Pandas

3