OwusuDynamo
commited on
Commit
·
2a920b3
1
Parent(s):
cf924d2
Upload 2 files
Browse files
src/__pycache__/preprocess.cpython-310.pyc
ADDED
Binary file (997 Bytes). View file
|
|
src/preprocess.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
"""
|
3 |
+
Created on Thu Jun 1 14:14:59 2023
|
4 |
+
|
5 |
+
@author: ME
|
6 |
+
"""
|
7 |
+
|
8 |
+
from datetime import datetime
|
9 |
+
import pandas as pd
|
10 |
+
import joblib
|
11 |
+
|
12 |
+
#load json file
|
13 |
+
json_path = r"C:/Users/ME/Desktop/Blessing_AI/Weather_Prediction/Artifacts/feature_dict.joblib"
|
14 |
+
loaded_data = joblib.load(json_path)
|
15 |
+
|
16 |
+
def preprocess_data(start_d,end_d,airport_name):
|
17 |
+
y, m , d = start_d
|
18 |
+
y2 , m2, d2 = end_d
|
19 |
+
start_date = datetime(y,m,d)
|
20 |
+
end_date = datetime(y2,m2,d2)
|
21 |
+
|
22 |
+
date_range = pd.date_range(start=start_date, end=end_date, freq='D')
|
23 |
+
df_pred = pd.DataFrame(columns=["ds","NAME","ELEVATION","month","day"])
|
24 |
+
airport_encoded = loaded_data["Airport_name"][airport_name]
|
25 |
+
elevation = loaded_data["elevation"][airport_name]
|
26 |
+
for date in date_range:
|
27 |
+
day = date.day
|
28 |
+
month = date.month
|
29 |
+
df_pred = df_pred.append({'ds':date,"NAME":airport_encoded,"ELEVATION":elevation, 'month': month, 'day': day}, ignore_index=True)
|
30 |
+
return df_pred
|