Solution 14.1
Perform the following steps to complete the activity:
- Open a new Jupyter notebook file. Import
pandas
anddateutil.parser
into your notebook:import pandas as pd from dateutil.parser import parse
- Define the path for the dataset and read the data:
# Defining the paths of the files filePath = '/content/drive/MyDrive/Packt_Colab/pandas_chapter11/chapter11/AirQualityUCI.csv' # Reading the text files data = pd.read_csv(filePath,delimiter=";") data.head()
You should get the following output:
- Drop the unwanted columns, as follows:
data = data.drop(['Unnamed: 15','Unnamed: 16'],axis=1) data.head()
You should get an output as follows:
data.shape
You should get the following output:
(9471, 15)
- Remove the
NA
values:data = data.dropna() data.shape
You should get the following...