Download NCERT – CBSE – NEW DELHI - Class 12 – Information Practice – Class 12 – Practical Model Qu and more Exams Computer science in PDF only on Docsity! 12IP-PRACTICAL MODEL QUESTIONS (23-24) A. Write the code to create the series ‘serObj’ and answer the questions followed. 1. Write the command to add one row: ‘May’ – 31 2. Write the command to update Feb to 29 3. Write the command to change index to 1,2,3,4,5 in place of Jan,Feb,Mar, Apr and May. 4. Write a command to print a month name having number of days less than 31. 5. Write the output: a) print(serObj<30) b) print(serObj + 3) B. Write the code to create a DataFrame ‘RESULT’ and answer the questions followed. Col1 Col2 Col3 T1 100.0 100.0 60.0 T2 95.8 100.0 57.48 T3 NaN 100.0 53.58 T4 82.0 85.4 49.20 1. Write a command to add one column Total = col1+col2+col3 2. Write a command to add one row T5 with values 75.6, 98.6, 56.0 3. Write a command to change the column names Col1 to Maths, Col2 to Science, Col3 to SST. 4. Write a command to print Score of Months and Science only. 5. Write a command to update NaN to 85.0 in T3 Row and Col1 C. Write the code to create a DataFrame ‘df’ and answer the questions followed. Maths Science SST Amit 100 100.0 60.0 Mohan 95 50.0 57.48 Sudha 85 90.0 53.58 1. Write a command to add one column Total = Maths+ Science + SST 2. Write a command to add one row T5 with values 75.6, 98.6, 56.0 3. Write a command to print Score of Maths and Science only. 4. Write a command to update marks of Science of Sudha to 85.0 5. Write a command to delete a row – Mohan D. Consider the following DataFrame df and answer the given questions Rollno Name UT1 UT2 UT3 UT4 1 Prerna Singh 24 24 20 22 2 Manish Arora 18 17 19 22 3 Tanish Goel 20 22 18 24 4 Falguni Jain 22 20 24 20 5 Kanika Bhatnagar 15 20 18 22 1. Write the command to print top two rows. 2. Write the command to print last two rows. 3. Write the command to add one more column in dataframe df name total. Total = UT1+UT2+UT3+UT4 4. Write the command to display the rows having roll no is 4 5. Write the command will display the column labels of the DataFrame? E. Write a program in Python Pandas to create the following DataFrame batsman from a Dictionary: B_NO Name Score1 Score2 1 Sunil Pillai 90 80 2 Gaurav Sharma 65 45 3 PiyushGoel 70 90 4 Kartik Thakur 80 76 1. Perform the following operations on the DataFrame 2. Add both the scores of a batsman and assign to column “Total” 3. Display the highest score in both Score1 and Score2 of the Data 4. Display the DataFrame. 5. Display the details of PiyushGoel F. Write a Python program to display a BAR CHART of the number of students in a school. Sample data: Group: I,II,III,IV and Strength: 38,30,45,49 1. Use different colors for each bar. 2. Title for x axis should be ‘Groups’ and title for y axis should be ‘Number of Students’ 3. Ensure the title of chart is “Group wise Students” and grid line must be shown. G. Write a Python program to display the given Result using a BAR CHART Maths Science SST Amit 100 100.0 60.0 Mohan 95 100.0 57.48 Sudha 85 100.0 53.58 1. Set the title of graph is “Result Analysis” 2. Display the legends. 3. Display the label of x axis to “Name” and y axis to “Score” H. Write a Python program to display the Result using a LINE PLOT Maths Science SST Amit 100 100.0 60.0 Mohan 95 100.0 57.48 Sudha 85 100.0 53.58 1. Set the title of graph is “Result Analysis” 2. Display the legends. 3. Display the label of x axis to “Name” and y axis to “Score” I. Draw the following bar graph representing the number of students in each class.