text_plain_output_1.png image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import plotly.express as px

import seaborn as sns

df = pd.read_csv('/kaggle/input/indian-restaurants-2023/restaurants.csv')

df.isnull().sum()

rating_across_state = df.groupby('City').mean()
rating_across_state.reset_index(level=0, inplace=True)
plt.xticks(rotation=90, fontsize=12)
plt.yticks(fontsize=12)
plt.ylim(1, 5)

fig = px.histogram(rating_across_state, x = 'Rating')
fig.show()

average_cost = df.groupby(['City'])['Cost'].mean().reset_index()
fig = px.bar(average_cost, x='City', y='Cost', labels={'City': 'City', 'Name': 'Average Cost of Restaurants'},
             title='Average Cost in Each City', color = 'City')
fig.show()

avg_vote = df.groupby(['City'])['Votes'].mean().reset_index()
fig = px.bar(avg_vote, x='City', y='Votes', labels={'City': 'City', 'Name': 'Average Number of Votes of Restaurants'},
             title='Average Votes in Each City', color = 'City')
fig.show()

max_votes = df.groupby(['City'])['Votes'].sum().reset_index()
fig = px.bar(max_votes, x='City', y='Votes', labels={'City': 'City', 'Name': 'Number of Votes of Restaurants'},
             title='Top Votes in Each City', color = 'City')
fig.show()

df_cuisine = df.groupby(['City', 'Cuisine'])['Name'].count().reset_index()
df_top_cuisine = df_cuisine.loc[df_cuisine.groupby('City')['Name'].idxmax()]
fig = px.bar(df_top_cuisine, x='City', y='Name', color='Cuisine', labels={'City': 'City', 'Name': 'Number of Restaurants'}, title='Top Cuisine in Each City')
fig.show()