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:
- Remove the row containing details of disease named Tuberculosis.
- Add a new disease named 'Malaria' caused by 'Protozoa'.
- Display the last 2 rows.
Code Writing
Advertisements
Solution
-
health.drop(3) -
health.loc[4] = ['maleria','Protozoa'] -
health.iloc[2:]
shaalaa.com
Is there an error in this question or solution?
