Skip to content

Instantly share code, notes, and snippets.

@liannewriting
Last active August 5, 2021 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save liannewriting/65710f273e9eae93bb05b3328eab32f7 to your computer and use it in GitHub Desktop.
Save liannewriting/65710f273e9eae93bb05b3328eab32f7 to your computer and use it in GitHub Desktop.
data_cleaning_202001
df_add_ex['address_std'] = df_add_ex['address'].str.lower()
df_add_ex['address_std'] = df_add_ex['address_std'].str.strip() # remove leading and trailing whitespace.
df_add_ex['address_std'] = df_add_ex['address_std'].str.replace('\\.', '') # remove period.
df_add_ex['address_std'] = df_add_ex['address_std'].str.replace('\\bstreet\\b', 'st') # replace street with st.
df_add_ex['address_std'] = df_add_ex['address_std'].str.replace('\\bapartment\\b', 'apt') # replace apartment with apt.
df_add_ex['address_std'] = df_add_ex['address_std'].str.replace('\\bav\\b', 'ave') # replace apartment with apt.
df_add_ex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment