English

Consider the given DataFrame 'health'. 0 1 2 3 Diseasename Common cold Chickenpox Cholera Tuberculosis Agent Virus Virus Bacteria Bacteria Write suitable Python statements for the following: - Informatics Practices

Advertisements
Advertisements

Question

Consider the given DataFrame 'health'.

  Diseasename Agent
0 Common cold Virus
1 Chickenpox Virus
2 Cholera Bacteria
3 Tuberculosis Bacteria

Write suitable Python statements for the following:

  1. Remove the row containing details of disease named Tuberculosis.
  2. Add a new disease named 'Malaria' caused by 'Protozoa'.
  3. Display the last 2 rows.
Code Writing

Solution

  1. health.drop(3) 
  2. health.loc[4] = ['maleria','Protozoa'] 
  3. health.iloc[2:] 
shaalaa.com
  Is there an error in this question or solution?
2022-2023 (March) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×