Datasets:
File size: 796 Bytes
3e60d6a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import os
import pandas as pd
basedir = './'
dirs = ['1.Raw(PM)','2.Raw(PM+Met)','3.Clean(PM+Met)','4.Grid(PM+Met)']
months = ['Nov2020', 'Dec2020', 'Jan2021']
months_fmt = {'Nov2020':'2020-11-{:02d}_all', 'Dec2020':'2020-12-{:02d}_all', 'Jan2021':'2021-01-{:02d}_all'}
def read(path, D):
if os.path.exists(path):
d = pd.read_csv(path)
D = pd.concat((D,d))
return D
for dir in dirs:
D = None
for month in months:
if 'Raw' not in dir:
D = read(os.path.join(basedir, dir, month+'.csv.gz'), D)
else:
for file in range(1,32):
D = read(os.path.join(basedir, dir, month, months_fmt[month].format(file) + '.csv.gz'), D)
print('{}: Shape {}, Mean PM2.5 {}'.format(dir, D.shape, D.pm2_5.mean()))
print('Done') |