text_plain_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

df = pd.read_csv('/kaggle/input/starbucks-nutrition/starbucks.csv', index_col=0)

df.describe

df.isnull().sum()

highest_calorie_item = df.loc[df['calories'].idxmax(), 'item']
highest_calorie_value = df['calories'].max()
lowest_calorie_item = df.loc[df['calories'].idxmin(), 'item']
lowest_calorie_value = df['calories'].min()

highest_fat_item = df.loc[df['fat'].idxmax(), 'item']
highest_fat_value = df['fat'].max()
highest_carb_item = df.loc[df['carb'].idxmax(), 'item']
highest_carb_value = df['carb'].max()
highest_fiber_item = df.loc[df['fiber'].idxmax(), 'item']
highest_fiber_value = df['fiber'].max()
highest_protein_item = df.loc[df['protein'].idxmax(), 'item']
highest_protein_value = df['protein'].max()

average_calories = df.groupby('type')['calories'].mean()

correlation = df[['calories', 'fat', 'carb', 'fiber', 'protein']].corr()
print('Correlation between Calorie Content and Nutrients:')
for nutrient in ['fat', 'carb', 'fiber', 'protein']:
    corr_value = correlation.loc['calories', nutrient]
    print(f'- {nutrient.capitalize()}: {corr_value:.2f}')