Air Quality Index Analysis with Python

Data Science Project on Air Quality Index Analysis with Python.

In this article, I will introduce you to a data science project on Air Quality Index Analysis with Python programming language. The Air Quality Index (AQI) is a standardized summary measure of ambient air quality used to express the level of health risk associated with particulate and gaseous air pollution.

Introduction to Air Quality Index Analysis

Consider the analysis of the air quality index as a criterion ranging from 0 to 500. The higher the value of the AQI, the higher the level of air pollution and the greater the problem of air quality. For example, an AQI value of 50 or less represents good air quality, while an AQI value greater than 300 represents unsafe air quality.

Also, Read – 100+ Machine Learning Projects Solved and Explained.

For each pollutant, an AQI value of 100 generally corresponds to a concentration in ambient air equal to the level of the national short-term ambient air quality standard for the protection of public health. AQI values ​​equal to or less than 100 are generally considered satisfactory.

When AQI values ​​are above 100, the air quality is unhealthy: first for certain groups of sensitive people, then for everyone as AQI values ​​increase.

The AQI is divided into six categories. Each category corresponds to a different level of health problem. Each category also has a specific colour. Colour allows people to quickly determine if the air quality is reaching unhealthy levels in their communities.

Data Science Project on Air Quality Index Analysis with Python

Now let’s get started with Data Science project on Air Quality Index analysis with Python. I will recommend you to use Kaggle notebook for this task. 

The reason why I am recommending you to use a Kaggle notebook you will understand at the end of this article, as we are going to use some APIs provided by Kaggle so I hope you will use a Kaggle notebook for the task of Air Quality Index analysis with Python.

Now let’s get started with this task by importing the necessary Python libraries:

Now I will define some values that I will keep using in this task:

colorscale = ['#77DD77','#33AF13','#F6D20E','#F17700','#FE6B64','#F12424']
PAPER_BGCOLOR = '#f5f2d0'
BGCOLOR = 'LightSteelBlue'

Now let’s define and visualize the significance of each colour that is used in the Air Quality Index:

AQI levels

I will be using the same colour codes as in the table above for all of the charts in this task to display the AQI levels. Now, let’s read the data and start with the task of analyzing the air quality index with Python:

Visualizing AQI Stations

The datasets I am using in this task are based on Indian AQI records. The air quality index is based on the measurement of emissions of particles (PM2.5 and PM10), ozone (O3), nitrogen dioxide (NO2), sulfur dioxide (SO2) and carbon monoxide (CO).

Most of the AQI stations on the map monitor both PM2.5 and PM10 data, but there are a few exceptions where only PM10 is available. Let’s visualize all the AQI stations in operation in India:

AQI Stations

Now let’s visualize the AQI stations per city in India:

AQI Stations per city

Analyzing Air Quality Index with Python

I will analyze the AQI in India by comparing the performance of before and after the lockdown, because we all saw a major change in the climate of almost every country because of the Lockdown.

The very first national lockdown to curb the spread of the coronavirus was imposed from March 23. Restricted lockdown or almost stops people movement i.e. have to stay in their homes and can only go out to buy essentials which means almost 0 vehicle movement, restricted movement of trucks, no construction, no moving industries or no construction.

So all the things that contribute to pollution have been completely stopped. As a result, the environment begins to heal.

Through the graph below, I will try to analyze this if the air quality has improved due to the lockdown. The left side of the plot will display the Before Lockout scenario and the right side will display the After Lockout scenario.

The colour scale used conforms to the standard Indian AQI calculation scale:

Air Quality Index Analysis

The lockdown has worked to reduce air pollution in India as air quality is at best “satisfactory” at all measuring stations.

Hope you liked this article on the Data Science Project on Air Quality Index Analysis with Python Programming Language. Please feel free to ask your valuable questions in the comments section below.

Default image
Aman Kharwal

I am a programmer from India, and I am here to guide you with Data Science, Machine Learning, Python, and C++ for free. I hope you will learn a lot in your journey towards Coding, Machine Learning and Artificial Intelligence with me.

Leave a Reply

Do NOT follow this link or you will be banned from the site!