CBSE Class 12 Informatics Practices Question 109 of 167

Python Pandas — I — Question 20

Back to all questions
20
Question

Question 20

How would you delete rows from a dataframe ?

Answer

To delete rows from a dataframe, we use the drop() function with the syntax:

<DF>.drop(sequence of indexes).

For example, the statement to delete the rows with indexes 2, 3, 4 from a dataframe df is df.drop([2, 3, 4]).