This practice paper contains various questions focusing on how to add, modify, delete rows and columns of a DataFrame with different options. It is an important topic for Class XII CBSE Boards Students and through this practice paper they will learn about the various concepts associated with the modifying DataFrame easily.
I have already explained dataframe creation practice problem in my previous practice paper DataFrame Practice Questions with Solutions (Part-I). You will practice more questions based on Accessing elements of DataFrame with DataFrame Practice Question with Solutions (Part-II)
Let’s start with Practice Paper -3
Question : Given a DataFrame namely “employee” that stores the details of employees: |
a) Add a column called “City” with the following details : [‘Janak Puri’,’Tilak Nagar’, ‘Shiv Nagar’, ‘Vikas Puri’, ‘Janak Puri’] |
b) Add a column called “Shift” with “Morning” for all the employees. |
c) Add a new row with the following details : [‘E106’, ‘Keerat’, ‘Analyst’, 70000, 15000, ‘Tilak Nagar’, ‘Morning’]. |
d) Delete column “Shift” from the above dataframe employee. |
e) Delete the record with employee id ‘E103’ and ‘E105’. |
f) Rename column “Bonus” as “Incentive”. |
Question : Given a DataFrame namely “data”. Write the code for the following commands |
a) Change the Eraser count as 15 instead of 25. |
b) Rename the index “Scale” as “Wooden Scale”. |
c) Change all the row label as ‘Product 1′, Product 2’, ‘Product 3’, ‘Product 4’. |
d) Change all the column name as ‘Discount’, ‘Total’ |
e) Add a new row ‘Product 5’ with value 10 and 100. |
Question : From the above dataframe ‘data’, create another dataframe ‘Products’ and it must not contain the column ‘Total’. |
Question : In the above dataframe ‘data’, add an empty column ‘Stock’. |
Question : Write the commands for the following statement after analysis the given dataframe ‘batsman’. [CBSE Sample Paper 2020-21] |
a) Add both the scores of a batsman and assign to column “Total”. |
b) Display the highest score in both Score 1 and Score 2 of the DataFrame. |
c) Display the DataFrame. |
Question : Consider the following dataframe “Employee” and answers the following questions : |
a) Print the details of youngest employee. |
b) Print the details of all clerk from the employee. |
c) Print the average Bonus. |
d) Print the total salary distributed among the employees. |
Question : Consider the following dataframe “Items” storing production in tones and answers the following questions : |
a) Total production for each state. |
b) Total production for each item type. |
c) How many States produces Wheat? |
d) Print details of the state with maximum Rice production. |
Do you want to learn more and practice various types of questions?
Click on the below links:
- DataFrame Practice Questions with Solutions (Part-I) – for creation DataFrame
- DataFrame Practice Questions with Solutions (Part-2) – for accessing DataFrame
- DataFrame Practice Questions with Solutions (Part-4) – for DataFrame attributes and functions.
1 comment
Best practice paper for add,edit,delete in dataframe.