Informatics Practices

How would you delete rows from a dataframe ?

Python Pandas

4 Likes

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]).

Answered By

2 Likes


Related Questions