text_plain_output_1.png
from json  import loads , dumps

import pandas as pd

file = open('/kaggle/input/swiggy-restaurants-dataset/data.json', 'r')
data = file.read()
file.close()
js = loads(data)

cuisines = []
for i in js['Abohar']['restaurants'].keys():
    cuisines += js['Abohar']['restaurants'][i]['cuisine'].split(',')
cuisines = list(set(cuisines))

pop_cui = []
for cuisine in cuisines:
    c = 0
    for i in js['Abohar']['restaurants'].keys():
        if cuisine in js['Abohar']['restaurants'][i]['cuisine']:
            c += 1
    pop_cui.append([cuisine, c])
df = pd.DataFrame(pop_cui, columns=['item', 'freq'])
df[df['freq'] == max(df['freq'])]

pop_cui = []
for cuisine in cuisines:
    c = 0
    for i in js['Abohar']['restaurants'].keys():
        if cuisine in js['Abohar']['restaurants'][i]['cuisine']:
            c += 1
    pop_cui.append([cuisine, c])
df = pd.DataFrame(pop_cui, columns=['item', 'freq'])
df.sort_values(by='freq', ascending=False).head(5)