0% found this document useful (0 votes)
7 views3 pages

PM2.5 Trends from Sensor Data

The document contains Python code that creates a DataFrame using Pandas to store air quality data, including PM2.5, PM10, temperature, humidity, and wind speed for various sensors over specific dates in June 2024. It then pivots the DataFrame to focus on PM2.5 values by date and sensor location. Finally, it generates a line plot to visualize the trends of PM2.5 levels across different sensors throughout the month.

Uploaded by

adipputra8888888
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

PM2.5 Trends from Sensor Data

The document contains Python code that creates a DataFrame using Pandas to store air quality data, including PM2.5, PM10, temperature, humidity, and wind speed for various sensors over specific dates in June 2024. It then pivots the DataFrame to focus on PM2.5 values by date and sensor location. Finally, it generates a line plot to visualize the trends of PM2.5 levels across different sensors throughout the month.

Uploaded by

adipputra8888888
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CODINGAN NYA

import pandas as pd

data = {

"tanggal": [

"2024-06-01","2024-06-01","2024-06-01","2024-06-01","2024-06-01",

"2024-06-05","2024-06-05","2024-06-05","2024-06-05","2024-06-05",

"2024-06-10","2024-06-10","2024-06-10","2024-06-10","2024-06-10",

"2024-06-15","2024-06-15","2024-06-15","2024-06-15","2024-06-15",

"2024-06-20","2024-06-20","2024-06-20","2024-06-20","2024-06-20",

"2024-06-25","2024-06-25","2024-06-25","2024-06-25","2024-06-25",

"2024-06-30","2024-06-30","2024-06-30","2024-06-30","2024-06-30",

],

"lokasi": [

"Sensor-1","Sensor-2","Sensor-3","Sensor-4","Sensor-5",

"Sensor-1","Sensor-2","Sensor-3","Sensor-4","Sensor-5",

"Sensor-1","Sensor-2","Sensor-3","Sensor-4","Sensor-5",

"Sensor-1","Sensor-2","Sensor-3","Sensor-4","Sensor-5",

"Sensor-1","Sensor-2","Sensor-3","Sensor-4","Sensor-5",

"Sensor-1","Sensor-2","Sensor-3","Sensor-4","Sensor-5",

"Sensor-1","Sensor-2","Sensor-3","Sensor-4","Sensor-5",

],

"PM25": [

32,28,35,40,30,

45,42,48,55,40,

60,58,65,78,55,

52,48,50,65,46,

35,32,38,42,30,

80,75,90,110,85,

55,52,60,70,50

],
"PM10": [

55,49,60,72,52,

78,70,82,95,72,

100,92,110,130,95,

88,80,85,110,78,

58,55,62,70,50,

145,135,160,200,150,

95,90,105,120,85

],

"suhu": [

30.2,29.8,30.5,31.0,29.5,

31.5,31.0,32.0,32.5,31.2,

33.0,32.8,33.5,34.0,32.5,

32.0,31.5,32.2,33.0,31.7,

30.8,30.5,31.0,31.5,30.2,

34.0,33.8,34.5,35.0,33.7,

32.8,32.5,33.0,33.5,32.2

],

"kelembapan": [

78,80,75,70,82,

65,67,62,60,68,

55,57,50,48,58,

60,63,58,55,64,

72,75,70,68,76,

45,48,40,38,47,

58,60,55,52,62

],

"kecepatan_angin": [

1.2,1.4,1.0,0.9,1.3,

1.1,1.2,0.8,0.7,1.0,

0.6,0.7,0.5,0.4,0.6,
0.9,1.0,0.7,0.5,0.9,

1.5,1.6,1.3,1.2,1.4,

0.4,0.4,0.3,0.2,0.3,

0.7,0.8,0.6,0.5,0.7

df = [Link](data)

# Menampilkan DataFrame

[Link]()

CODE 2
pivot_pm25 = [Link](index='tanggal', columns='lokasi', values='PM25')

pivot_pm25

Code 3
[Link](figsize=(12,6))

[Link](pivot_pm25)

[Link]("Tren PM2.5 Antar Sensor (1 Juni – 30 Juni 2024)")

[Link]("Tanggal")

[Link]("PM2.5")

[Link](pivot_pm25.columns)

[Link](True)

[Link]()

You might also like