In this section, we'll look at how to remove columns or rows from a dataset in pandas. We will come to understand the drop() method and the functionality of its parameters in detail.
To start with, we first import the pandas module into our Jupyter notebook:
import pandas as pd
After this, we read our CSV dataset using the following code:
data = pd.read_csv('data-titanic.csv', index_col=3)data.head()
The dataset should look something like the following:
To remove a single column from our dataset, the pandas drop() method is used. The drop() method consists of two parameters. The first parameter is the ...