English

Consider The following DataFrame 'mdf'. 0 1 2 3 4 Rollno 1 2 3 4 5 Name Aditya Balwant Chirag Deepak Eva English 23 18 27 11 17 Hindi 20 1 23 3 21 Maths 28 25 30 7 24 - Informatics Practices

Advertisements
Advertisements

Question

Consider The following DataFrame 'mdf'.

  Rollno Name English Hindi Maths
0 1 Aditya 23 20 28
1 2 Balwant 18 1 25
2 3 Chirag 27 23 30
3 4 Deepak 11 3 7
4 5 Eva 17 21 24
  1. Write Python statements for the DataFrame 'mdf':
    1. To display the records of the students having roll numbers 2 and 3.
    2. To increase the marks of subject Math by 4, for all students.
  2. Write Python statement to display the Rollno and Name of all students who secured less than 10 marks in Maths.
                                    OR 
    Write Python statement to display the total marks i.e., sum of marks secured in English, Hindi and Maths for all students.
Short Answer

Solution

    1. mdf.iloc[1:3]
    2. mdf['Maths']=mdf['Maths']+4
  1. mdf.loc[:,['roll no','name']][mdf['Maths']<10]
                             OR
    Print(mdf.English + mdf.Hindi + mdf.Maths)
shaalaa.com
  Is there an error in this question or solution?
2022-2023 (March) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×