CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

DataFrame operations (3 Marks Questions)

  1. Consider the below given data from and write the command for the following: (The output should display a single value)
  2.    Qty1  Qty2  Qty3
    0    20    80    70
    1    30    85    87
    2    40    82    22

    • Find the mean of the middle row
    • Add a column Qty4 with values (Qty1+Qty2+Qty3)
    • Count the No of Values in Qty4 which is more than 165.

  3. Considering the DataFrame dfd write the commands for Statement 1,2 and 3: (The output should display a single value)
    dfd = pd.DataFrame({
     'Name':['Saourabh','Ram','Shyam', 'Mohan', 'Raghav'],
     'Subjects':['ECO','BST','ECO', 'ACCT', 'ACCT'],
     'Marks':[80,85,82,65,80],
     })
    
    • Statement 1: Find the sum of ‘ECO’ Marks using groupby()
    • Statement 2: Increase each marks by 10%
    • Statement 3: Find the mean marks for each subject

  4. Consider the dfd data frame from Question 16. Write the Output for the following:
    a. dfd.loc[2:,'Subjects'].head(3)
    b. dfd.loc[0:3].Marks.mean()
    c. dfd.loc[0:1].Marks.mean()
    


No comments:

Post a Comment