Skip to content

Instantly share code, notes, and snippets.

@kunalrustagi08
Created May 4, 2020 15:34
Show Gist options
  • Save kunalrustagi08/fc9a5829f91dadd8ef9050e5ad16c581 to your computer and use it in GitHub Desktop.
Save kunalrustagi08/fc9a5829f91dadd8ef9050e5ad16c581 to your computer and use it in GitHub Desktop.
import pandas as pd
col_dict = {'title':book_title, 'price':product_price, 'rating':star_rating}
book_store = pd.DataFrame(col_dict)
print(book_store.head())
print(book_store.dtypes)
book_store['price'] = book_store['price'].apply(lambda x : float(x[2:]))
number_mapping = {'One':1,'Two':2,'Three':3,'Four':4,'Five':5}
book_store['rating'] = book_store['rating'].apply(lambda x : number_mapping.get(x))
print(book_store.head())
print(book_store.dtypes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment