Activity 5.01 – Creating a multi-index from columns
In this activity, you will read in a DataFrame from a file and then use some of the columns to create a sorted multi-index. Suppose you have been given a .csv
file containing data about mushrooms, which, as you understand it, contains a classification of edible or poisonous mushrooms, as well as many visual features to allow them to be identified. Since you are a mushroom hunting enthusiast, you are very interested in analyzing and summarizing the data. You begin by reading the data in. Let's get started:
- For this activity, all you will need is the
pandas
library. Load it into the first cell of the notebook. - Read in the
mushroom.csv
data from theDatasets
directory and list the first five rows using.head()
. - You will see the class column and many visible attributes. List all the columns to see what else there is to work with. The result should be as follows: