The dataset for this tutorial can be found here University of Regina. Just download this pdf and convert this to excel with comma separated values (.CSV). To do this just go to youtube you'll find some great tutorials out there.
from google.colab import files
uploaded = files.upload()
Saving UofR.csv to UofR.csv
import pandas as pd
import numpy as np
import io
df2 = pd.read_csv(io.BytesIO(uploaded['UofR.csv']))
# Dataset is now stored in a Pandas Dataframe
df2.head()
Last Name | First Name | Current Salary | Administrative/ Research Stipend | Market Supplement | Total | |
---|---|---|---|---|---|---|
0 | Bredohl | Thomas | 135,110.00 | NaN | NaN | 135,110.00 |
1 | Brigham | R. Mark | 174,973.00 | NaN | NaN | 174,973.00 |
2 | Britto | Sarah | 133,292.00 | 4,150.00 | NaN | 137,442.00 |
3 | Brotheridge | Neil | 164,260.00 | NaN | NaN | 164,260.00 |
4 | Brown | Douglas | 124,952.00 | NaN | NaN | 124,952.00 |
df2 = df2.replace(np.NaN, 0)
df2.head(10)
Last Name | First Name | Current Salary | Administrative/ Research Stipend | Market Supplement | Total | |
---|---|---|---|---|---|---|
0 | Bredohl | Thomas | 135,110.00 | 0 | 0 | 135,110.00 |
1 | Brigham | R. Mark | 174,973.00 | 0 | 0 | 174,973.00 |
2 | Britto | Sarah | 133,292.00 | 4,150.00 | 0 | 137,442.00 |
3 | Brotheridge | Neil | 164,260.00 | 0 | 0 | 164,260.00 |
4 | Brown | Douglas | 124,952.00 | 0 | 0 | 124,952.00 |
5 | Brown | Janine | 96,824.00 | 0 | 11,180.00 | 108,004.00 |
6 | Bruno | Paul | 109,851.00 | 0 | 0 | 109,851.00 |
7 | Buehler | Alex | 109,761.00 | 0 | 0 | 109,761.00 |
8 | Bundock | Chris | 106,571.00 | 0 | 0 | 106,571.00 |
9 | Burlingham | Clay | 106,571.00 | 0 | 0 | 106,571.00 |
Thanks to StackOverflow for helping me with the capatilize() - which capitalizes the first letter of the word in whichever format you write, whereas the str.contain() - is used to match the string that we are looking for. So this acts as a search engine, wherein you can search for the name of the prof that you want and you'll get your answer. Make sure that you enter the first name of the professor that you are looking for.
name = input("Enter the first name of the prof that you want to search")
name = name.capitalize()
df2[df2['First Name'].str.contains(name)]
Enter the first name of the prof that you want to searchCortney
Last Name | First Name | Current Salary | Administrative/ Research Stipend | Market Supplement | Total | |
---|---|---|---|---|---|---|
14 | Butz | Cortney | 164,008.00 | 10,000.00 | 0 | 174,008.00 |