course content

Course Content

Data Manipulation using pandas

Removing RowsRemoving Rows

Let's see what are the differences that caused these issues by displaying these rows.

These are not consequent observations, and it's only half a percent of all observations, so we can easily delete them. If you want to delete rows or columns, apply the .drop() method to dataframe. If you want to remain changes saved, either reassign to dataframe result of applying method, or set the inplace = True parameter. If you want to drop rows, set the index parameter to indexes of rows you want to remove, if you want to delete columns - set the columns parameter to list of columns you want to delete. For instance, if you want to delete the first, and the third rows, you should apply the .drop(index = [0, 2]) method. If you want to delete 3-5 columns, then you can get their names from the .columns attribute, and apply the .drop(columns = df.columns[2:5]) method. Feel free to experiment!

Section 2.

Chapter 2