text_plain_output_1.png
import pandas as pd

data.shape

data.isnull().sum()

data.address[1]

data = data.rename({'approx_cost(for two people)': 'cost'}, axis=1)
data['cost'] = data['cost'].replace(',', '', regex=True)

data[['votes', 'cost']] = data[['votes', 'cost']].apply(pd.to_numeric)

grouped = data.groupby(['name', 'address']).agg({'listed_in(type)': list})
newdata = pd.merge(grouped, data, on=['name', 'address'])

newdata['listed_in(type)_x'] = newdata['listed_in(type)_x'].astype(str)
newdata.drop_duplicates(subset=['name', 'address', 'listed_in(type)_x'], inplace=True)

newdata.shape

newdata.index = newdata['name']

newdata.drop(['name', 'url', 'phone', 'listed_in(city)', 'listed_in(type)_x', 'address', 'dish_liked', 'listed_in(type)_y', 'menu_item', 'cuisines', 'reviews_list'], axis=1, inplace=True)

newdata.head(3)