Answered step by step
Verified Expert Solution
Link Copied!

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

Q6: 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 = INST201 should be associated with classlevel =200.
IMPORTANT NOTE: The input data here depends on the output of Q1: do NOT attempt until you've gotten Q1 right! Similarly, if you shutdown your notebook and come back here to resume your work, you'll need to run the cells for Q1 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:
x(str)- 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 df_course_level(). It should take this input:
df (dataf rame)- a dataframe (output of Q1)
And return:
result (dataf rame)- a modified dataframe with a classlevel column with appropriate values
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions