How to do it...

  1. Read in the college dataset, and set the institution name as the index:
>>> college = pd.read_csv('data/college.csv', index_col='INSTNM')
  1. Attempt to select all colleges with names lexicographically between 'Sp' and 'Su':
>>> college.loc['Sp':'Su']
KeyError: 'Sp'
  1. As the index is not sorted, the preceding command fails. Let's go ahead and sort the index:
>>> college = college.sort_index()
  1. Now, let's rerun the same command from step 2:
>>> college.loc['Sp':'Su']

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset