Introduction – Air quality directly impacts the quality of all living beings. It is critical to understand and predict more about the air we breathe

#Introduction-–-Air-quality-directly-impacts-the-quality-of-all-living-beings.-It-is-critical-to-understand-and-predict-more-about-the-air-we-breathe

I’m trying to come up with a best model that can predict the trend of air pollutants in 10 major cities in the united states

#I’m-trying-to-come-up-with-a-best-model-that-can-predict-the-trend-of-air-pollutants-in-10-major-cities-in-the-united-states

This notebook is dedicated to understand more about the dataset and get it prepared for predictions

#This-notebook-is-dedicated-to-understand-more-about-the-dataset-and-get-it-prepared-for-predictions
Loading output library...

Mapping cities on a map using GeoCode to understand the distribution of data

#Mapping-cities-on-a-map-using-GeoCode-to-understand-the-distribution-of-data

Selecting major cities spread across US.

#Selecting-major-cities-spread-across-US.

Poll_year = pollution.loc[pollution'City' == 'Tucson', 'Year'].value_counts() Poll_year

Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...

Pollutant concentration levels and AQIs across cities to undertand the trend

#Pollutant-concentration-levels-and-AQIs-across-cities-to-undertand-the-trend
Loading output library...

Pollutant AQI levels

#Pollutant-AQI-levels
Loading output library...

Trends look similar for concentration levels and AQI. Moreover AQI is computed using concentration of a pollutant. So dropping all the concentration pollutant levels and focusing on just AQI levels

#Trends-look-similar-for-concentration-levels-and-AQI.-Moreover-AQI-is-computed-using-concentration-of-a-pollutant.-So-dropping-all-the-concentration-pollutant-levels-and-focusing-on-just-AQI-levels
Loading output library...

Understanding pollutant trend by city

#Understanding-pollutant-trend-by-city
Loading output library...

for city in cities: print (d city.shape, city)

Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...

List of Cities with high AQIs

#List-of-Cities-with-high-AQIs
Loading output library...
Loading output library...

Chow Test

#Chow-Test

It looks like the pollutant have been trendong downwards after 2008. Let's check to see if this assumption is true or not with a Chow test.

#It-looks-like-the-pollutant-have-been-trendong-downwards-after-2008.-Let's-check-to-see-if-this-assumption-is-true-or-not-with-a-Chow-test.

Visualizing pollution over the years on the US map

#Visualizing-pollution-over-the-years-on-the-US-map
Loading output library...

data=[] layout = dict( title = 'Yearly Max AQI in 2015', width = 1000, height = 600 )

data = [ go.Scattergeo( locationmode = 'USA-states', lon = pol_city_unique"Longitude", lat = pol_city_unique"Latitude", text = pol_city_unique"City",

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
    mode = 'markers',
    marker = dict( 
        size = 8, 
        opacity = 0.8,
        reversescale = True,
        autocolorscale = False,
        symbol = 'square',
        line = dict(
            width=1,
           color='rgba(102, 102, 102)'
            ),
        colorscale = scl,
        cmin = 0,
        color = pq['O3_AQI'],
        cmax = pq['O3_AQI'].max(),
        colorbar=dict(
            title="O3 Values"
        )
    ))]

        
   

layout = dict( title = 'US Cities

(Hover for City names)', geo = dict( scope='usa', projection=dict( type='albers usa' ), showland = True, landcolor = "rgb(250, 250, 250)", subunitcolor = "rgb(217, 217, 217)", countrycolor = "rgb(217, 217, 217)", countrywidth = 0.5, subunitwidth = 0.5
), ) fig = go.Figure(data=data, layout=layout ) py.iplot(fig, filename='O3' )

Creating and dividing cities based on zones

#Creating-and-dividing-cities-based-on-zones
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...
Loading output library...