Created
November 28, 2017 02:57
-
-
Save Terryhung/c2c4bebc93a9317f4f438da93edcf851 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lower_df(df): | |
pattern = re.compile('\W+') | |
for field in ['name', 'category_name', 'brand_name', 'item_description']: | |
_str = list(map( | |
lambda x: re.sub(pattern, ' ', x), | |
df[field].str.lower() | |
)) | |
df[field] = _str |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment