Index selection performance drastically improves when the index is unique or sorted. The prior recipe used an unsorted index that contained duplicates, which makes for relatively slow selections.
Selecting with unique and sorted indexes
Getting ready
In this recipe, we use the college dataset to form unique or sorted indexes to increase the performance of index selection. We will continue to compare the performance to boolean indexing as well.
How to do it...
- Read in the college dataset, create a separate DataFrame with STABBR as the index, and check whether the index...