Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q 6 : Extract information about the level of each course Create a function that creates a new column ( classlevel ) in in your
Q: Extract information about the level of each course
Create a function that creates a new column classlevel in in your dataframe that contains information about the "level" of each course. For example, the row with classcode INST should be associated with classlevel
IMPORTANT NOTE: The input data here depends on the output of Q: do NOT attempt until you've gotten Q right! Similarly, if you shutdown your notebook and come back here to resume your work, you'll need to run the cells for Q before you resume here.
ALSO: make sure that your column name is exactly classlevel pay attention to spaces, etc. so that the test cases will pass.
You will first need to define a function level that takes this input:
a "classcode" entry
And return:
result str the corresponding "classlevel" value
Hint: There are a number of valid way to solve this, including string parsing, dictionaries, and conditionals.
Then you need to define a function dfcourselevel It should take this input:
df dataf rame a dataframe output of Q
And return:
result dataf rame a modified dataframe with a classlevel column with appropriate values
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started