OwusuDynamo's picture
Upload 2 files
2a920b3
raw
history blame
967 Bytes
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 1 14:14:59 2023
@author: ME
"""
from datetime import datetime
import pandas as pd
import joblib
#load json file
json_path = r"C:/Users/ME/Desktop/Blessing_AI/Weather_Prediction/Artifacts/feature_dict.joblib"
loaded_data = joblib.load(json_path)
def preprocess_data(start_d,end_d,airport_name):
y, m , d = start_d
y2 , m2, d2 = end_d
start_date = datetime(y,m,d)
end_date = datetime(y2,m2,d2)
date_range = pd.date_range(start=start_date, end=end_date, freq='D')
df_pred = pd.DataFrame(columns=["ds","NAME","ELEVATION","month","day"])
airport_encoded = loaded_data["Airport_name"][airport_name]
elevation = loaded_data["elevation"][airport_name]
for date in date_range:
day = date.day
month = date.month
df_pred = df_pred.append({'ds':date,"NAME":airport_encoded,"ELEVATION":elevation, 'month': month, 'day': day}, ignore_index=True)
return df_pred