Here is a quick lesson on working with rows in DataFrames
Let’s start by building a DateFrame

Lets start by deleting (or dropping) a row:

Let’s try dropping a couple of rows:

[-1] allows us to drop the last row:

Side note:
Here is another method from pandas you should know. This is the shape method. See it returns (rows, columns)

We can filter rows out using conditional logic

The index method returns the row indexes

We can use the .index as well as conditional logic to add a new column to our dataframe

Using append(), we can add a dictionary as a new row to the DataFrame

Finally, using .iloc we can iterate through the values of a row

Last Lesson: Pandas Renaming Columns
Next Lesson: Python: Working with Rows in DataFrames
Return to: Python for Data Science Course
Follow this link for more Python content: Python