Commit e1f2ec62 authored by dasharatha.vamshi's avatar dasharatha.vamshi

forcast_data.csv

parent 4c3c1b24
......@@ -10,7 +10,8 @@ from scripts.common.logsetup import logger
class PreProcessComponent:
def __init__(self):
self.ds, self.tempmax, self.tempmin, self.temp, self.humidity, self.precip, self.winddir, self.cloudcover, self.visibility, self.date, self.windspeed = ([] for i in range(11))
self.ds, self.tempmax, self.tempmin, self.temp, self.humidity, self.precip, self.winddir, self.cloudcover, self.visibility, self.date, self.windspeed = (
[] for i in range(11))
def read_pickle_file(self, file):
try:
......@@ -50,7 +51,7 @@ class PreProcessComponent:
sc_X = self.read_pickle_file(standard_scalar_pkl_path)
X = sc_X.transform(forcast_data)
return X, self.date
return X, self.date, forcast_data
if __name__ == '__main__':
......@@ -85,7 +86,7 @@ if __name__ == '__main__':
else:
raise Exception(ComponentExceptions.INVALID_Fillna_Method)
obj = PreProcessComponent()
data, date_pkl = obj.preprocess(json_path, standard_scalar_path, fillna_method)
data, date_pkl, forcast_df = obj.preprocess(json_path, standard_scalar_path, fillna_method)
logger.info("Got the data writing it to pickle files (preprocessed_X.pkl and date_X.pkl)")
try:
output = open(os.path.join(shared_volume, 'preprocessed_X.pkl'), 'wb')
......@@ -94,6 +95,8 @@ if __name__ == '__main__':
output1 = open(os.path.join(shared_volume, 'date_X.pkl'), 'wb')
pickle.dump(date_pkl, output1)
output1.close()
output2 = os.path.join(shared_volume, 'forcast_data.csv')
forcast_df.to_csv(output2, index=False)
logger.info("Component executed Successfully")
except Exception as e:
raise Exception(e)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment