Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Analytical Programming Please write all the answer on paper and jovian step by step SECTION B. Instructions: Answer 1 question ONLY. Write your answers in

Analytical Programming
Please write all the answer on paper and jovian step by step
image text in transcribed
image text in transcribed
SECTION B. Instructions: Answer 1 question ONLY. Write your answers in the Answer Booklet. QUESTION 1 [40 Marks] a. Write a Pandas program to select the rows where the number of attempts in the examination is greater than 2 . Sample Python dictionary data and list labels: exam data = ['name': ['Anastasia', 'Dima', 'Katherine', 'James', 'Emily', 'Michael', 'Matthew', 'Laura', 'Kevin', 'Jonas'], 'score': [12.5, 9, 16.5, np.nan, 9, 20, 14.5, np.nan, 8, 19]. 'attempts': [1,3,2,3,2,3,1,1,2,1], 'qualify': [yyes', 'no', 'yes', 'no', 'no', 'yes', 'yes', no', no', 'yes']\} labels = [a', 'b', 'c', 'd', 'e', 'f,' 'g', 'h', 'i, J] Expected Output: Number of attempts in the examination is greater than 2: name score attempts qualify b Dima 9.03 no d James NaN 3 no f Michael 20.03 yes (20 marks) b. Write a Pandas program to convert a NumPy array to a Pandas series. Sample NumPy array: dl=[10,20,30,40,50] Expected Output: NumPy array: [10 2030 40 50] Converted Pandas series: 010 120 344050 450 dtype: int64 (20 marks) a. Write a Pandas program to sort the data frame first by 'name' in descending order, then by 'score' in ascending order. Sample DataFrame: exam_data = \{'name': [Anastasia', 'Dima', 'Katherine', 'James', 'Emily'], 'score': [12.5, 9, 16.5, np.nan, 9], 'attempts': [1,3,2,3,2], 'qualify': [yes', 'no', 'yes', 'no', 'no'] labels =[a, 'b, c , d ', 'e'] Values for each column will be: name : 'Suresh', score: 15.5, attempts: 1, qualify: 'yes', label: ' k

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

Why are small-lot sizes not as effective in a push system?

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago