Last active
July 18, 2018 04:27
-
-
Save erikgregorywebb/6197dd604713987af81e00c92321ae9b to your computer and use it in GitHub Desktop.
This file contains 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 cleanLlistings(df): | |
# Split the location variable into location and days_online | |
df['location'], df['days_online'] = df['location'].str.split('|', 1).str | |
# Remove the dollar sign in price | |
df['price'] = df['price'].str.replace('$', '') | |
df['price'] = df['price'].str.replace(',', '') | |
# Convert from string to numeric | |
df['views'] = pd.to_numeric(df['views']) | |
df['favorites'] = pd.to_numeric(df['favorites']) | |
return df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment