└── miniproject.py /miniproject.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import matplotlib.pyplot as plt 3 | 4 | 5 | file_path = r'C:\Users\KANISHKA SAKTHIVEL\Desktop\Jupyter\food_ingredients_and_allergens.csv' 6 | df = pd.read_csv(file_path) 7 | 8 | 9 | df['Main Ingredient'] = df['Main Ingredient'].str.split(',') 10 | ingredient_df = df.explode('Main Ingredient') 11 | 12 | ingredient_df['Main Ingredient'] = ingredient_df['Main Ingredient'].str.strip() 13 | 14 | ingredient_df['Main Ingredient'] = ingredient_df['Main Ingredient'].str.strip() 15 | 16 | 17 | plt.figure(figsize=(12, 8)) 18 | ingredient_counts.sort_index().plot(kind='line', marker='o', color='blue') 19 | plt.title('Frequency of Main Ingredients in Food Products') 20 | plt.xlabel('Main Ingredient') 21 | plt.ylabel('Frequency') 22 | plt.xticks(rotation=45, ha='right') 23 | plt.grid(axis='y', linestyle='--', alpha=0.7) 24 | plt.show() --------------------------------------------------------------------------------