CBSE Science (English Medium) इयत्ता १२ Important Questions for Informatics Practices - Data Handling using Pandas - I
Advertisements
Advertisements
Chapter wise important questions with answers and solutions for Informatics Practices in CBSE Science (English Medium) इयत्ता १२.
To display the last five rows of a series object ‘S’, you may write ______
पाठ: [2] Data Handling using Pandas - I
Which of the following statement will import pandas library?
पाठ: [2] Data Handling using Pandas - I
Which of the following can be used to specify the data while creating a DataFrame?
पाठ: [2] Data Handling using Pandas - I
Assertion (A): DataFrame has both a row and column index.
Reasoning (R): A DataFrame is a two-dimensional labelled data structure like a table of MySQL.
पाठ: [2] Data Handling using Pandas - I
Write a program to create a series of objects using a dictionary that stores the number of students in each house of class 12D of your school.
Note: Assume four house names are Beas, Chenab, Ravi, and Satluj having 18, 2, 20, and 18 students respectively and pandas library has been imported as pd.
पाठ: [2] Data Handling using Pandas - I
What will be the output of the following code:
>>>import pandas as pd
>>>A = pd.Series(data = [35, 45, 55, 40])
>>>print(A > 45)पाठ: [2] Data Handling using Pandas - I
Carefully observe the following code:
import pandas as pd
Year1 = {'Q1':5000,'Q2':8000,'Q3':12000,'Q4': 18000} Year2 = {'A' :13000,'B':14000,'C':12000}
totSales = {1:Year1,2:Year2}
df = pd.DataFrame(totSales)
print(df)
Answer the following:
- List the index of the DataFrame df
- List the column names of DataFrame df.
पाठ: [2] Data Handling using Pandas - I
Write a Python code to create a DataFrame with appropriate column headings from the list given below:
[[101,'Gurman',98], [102,'Rajveer',95], [103,'Samar' ,96], [104,'Yuvraj',88]]
पाठ: [2] Data Handling using Pandas - I
Consider the given DataFrame ‘Stock’:
| Name | Price | |
| 0 | Nancy Drew | 150 |
| 1 | Hardy boys | 180 |
| 2 | Diary of a wimpy kid | 225 |
| 3 | Harry Potter | 500 |
Write suitable Python statements for the following:
- Add a column called Special_Price with the following data: [135,150,200,440].
- Add a new book named ‘The Secret' with a price of 800.
- Remove the column Special_Price.
पाठ: [2] Data Handling using Pandas - I
Mr. Som, a data analyst has designed the DataFrame df that contains data about Computer Olympiad with ‘CO1’, ‘CO2’, ‘CO3’, ‘CO4’, and ‘CO5’ as indexes shown below. Answer the following questions:
| School | Tot_students | Topper | First_Runnerup | |
| CO1 | PPS | 40 | 32 | 8 |
| CO2 | JPS | 30 | 18 | 12 |
| CO3 | GPS | 20 | 18 | 2 |
| CO4 | MPS | 18 | 10 | 8 |
| CO5 | BPS | 28 | 20 | 8 |
- Predict the output of the following python statement:
i. df.shape
ii. df[2:4] - Write a Python statement to display the data of the Topper column of indexes CO2 to CO4.
OR
Write a Python statement to compute and display the difference of data of the Tot_students column and First_Runnerup column of the above given DataFrame.
