Session Ready
Exercise

Dictionary to DataFrame (2)

The Python code that solves the previous exercise is included on the right. Have you noticed that the row labels (i.e. the labels for the different observations) were automatically set to integers from 0 up to 6?

To solve this a list row_labels has been created. You can use it to specify the row labels of the cars DataFrame. You do this by setting the index attribute of cars, that you can access as cars.index.

Instructions
100 XP
  • Hit Run Code to see that, indeed, the row labels are not correctly set.
  • Specify the row labels by setting cars.index equal to row_labels.
  • Print out cars again and check if the row labels are correct this time.