Get startedGet started for free

Standard DataFrame methods

You are given the diabetes dataset storing information on female patients tested for diabetes. You will focus on blood glucose levels and the test results. Subjects, tested positively, usually have higher blood glucose levels after performing the so-called glucose tolerance test. Your task is to investigate whether it is true for this specific dataset.

The plasma glucose column corresponds to the glucose levels. The test result column corresponds to the diabetes test results.

You must use standard DataFrame methods (the numpy module is not imported for you).

This exercise is part of the course

Practicing Coding Interview Questions in Python

View Course

Exercise instructions

  • Load the data from the diabetes.csv file.
  • Calculate the mean glucose level in the entire dataset.
  • Group the data according to the diabetes test results.
  • Calculate the mean glucose levels per group.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Load the data from the diabetes.csv file
diabetes = ____
print(diabetes.info())

# Calculate the mean glucose level in the entire dataset
print(____)

# Group the data according to the diabetes test results
diabetes_grouped = ____

# Calculate the mean glucose levels per group
print(____)
Edit and Run Code