<jupyter_start><jupyter_text>**Air quality in Lagos** In this notebook, we will explore a dataset of air quality obtained from the Purpleair sensor in Lagos that took readings every 30min from 12/2019 until it stopped reporting back in 6/2021 Description of some features:1. PM 1.0 - Ambient suspended particulate matter,  the mass concentration of ambient suspended particulate matter (PM) of an aerodynamic diameter of less than 1 micrometer.2. PM 2.5  - Fine particulate matter, an air pollutant that is a concern for people's health when levels in air are high. PM2.5 are tiny particles in the air that reduce visibility and cause the air to appear hazy when levels are elevated3. PM 10 - particulate matter in the air with a diameter of 10 micrometers or less, including smoke, dust, soot, salts, acids, and metals. Particulate matter can also be formed indirectly when gases emitted from motor vehicles and industries undergo chemical reactions in the atmosphere.Note that: CF=1 is applicable for a standard environment (indoors / chamber) while the CF=ATM is applicable under atmospheric environment (outdoors / am202bient).Particulate matter is the sum of all solid and liquid particles suspended in air many of which are hazardous. This complex mixture includes both organic and inorganic particles, such as dust, pollen, soot, smoke, and liquid droplets.4. RSSI_dbm - This is referred to the signal strength of Wifi5. Temperature - The degree of hotness or coldness measured on a definite scale.6. Humidity - Humidity is the amount of water vapor in the air. If there is a lot of water vapor in the air, the humidity will be high and vice versa7. Uptime - The time during which the sensor is in operation.<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime
import seaborn as sns
from datetime import datetime
sns.set_theme(style="whitegrid")
sns.set_palette('bright')
%matplotlib inline

import warnings
warnings.filterwarnings("ignore")
url = "https://raw.githubusercontent.com/gideononyewuenyi/Exploratory-analysis/main/Lekki%20Phase%201%20(outside)%20(6.451397%203.471201)%20Primary%2030_minute_average%2012_17_2019%206_6_2021.csv"
df = pd.read_csv (url)
df.sample(5)
df.describe()
df.shape
df.columns
df.dtypes
df.isnull().sum()
df.isnull().sum().sum()
new_df=df.drop(columns = ['Unnamed: 9'])
new_df.columns
new_df.isnull().sum()
new_df.isnull().sum().sum()
new_df.shape
new_df_drop = new_df.dropna()
new_df_drop.shape
new_df_drop.isnull().sum()
new_df_ffill = new_df.fillna(method='ffill')
new_df_bfill = new_df.fillna(method='bfill')
new_df_ffill.shape
new_df_bfill.shape
new_df_drop.shape
new_df_ffill.head()
new_df_ffill.tail()
new_df_ffill.sample(5)
new_df_ffill.describe()
new_df_ffill.nunique()
new_df_ffill.rename(columns={'created_at': 'Date/Time'}, inplace=True)
new_df_ffill.dtypes<jupyter_output><empty_output><jupyter_text>Attempt to locate the month of June 2021 **The month of June 2021 has only one week of data**<jupyter_code>new_df_ffill.tail(495)<jupyter_output><empty_output><jupyter_text>JUNE 2021<jupyter_code>june21 = new_df_ffill.iloc[37101:37595]
june21
june21 = june21[['Date/Time', 'Temperature_F', 'Humidity_%', 'PM2.5_ATM_ug/m3']]
june21
june21.plot()
plt.legend(bbox_to_anchor=(1.5,1), loc="upper right")
june21.plot(subplots=True, x = 'Date/Time', figsize=(14,8))
plt.tick_params(labelsize = '8.0', labelrotation = 1.0)
june21.plot(x="Date/Time", y= 'PM2.5_ATM_ug/m3', figsize=(20,4))<jupyter_output><empty_output><jupyter_text>Attempt to locate the first day of the month of June 2021<jupyter_code>new_df_ffill.iloc[37101:37150]<jupyter_output><empty_output><jupyter_text>01 JUNE 2021<jupyter_code>june1_21 = new_df_ffill.iloc[37101:37150]
june1_21 = june1_21[['Date/Time', 'Temperature_F', 'Humidity_%', 'PM2.5_ATM_ug/m3']]
june1_21.plot()
plt.legend(bbox_to_anchor=(1.5,1), loc="upper right")
june1_21.plot(subplots=True, x = 'Date/Time', figsize=(14,8))
plt.tick_params(labelsize = '8.0', labelrotation = 1.0)
june1_21.plot(x="Date/Time", y= 'PM2.5_ATM_ug/m3', figsize=(20,4))
plt.axhline(35.4, color ="red")
plt.title("PM2.5 measurement in Lagos\non 2021-06-01", size=15)
plt.xlabel('TIME', size=12)
plt.ylabel('PM2.5', size=12)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1104868913857678, 'fraction_numerical': 0.05500936329588015, 'mean_word_length': 6.329331046312179, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '417589', 'license': 'MIT', 'n_tokens_mistral': 1665, 'n_tokens_neox': 1483, 'n_words': 428, 'path': 'Data_Viz_2.ipynb', 'repo_name': 'gideononyewuenyi/Exploratory-analysis', 'size': '4272'}