Created
October 10, 2018 19:52
-
-
Save jgarciabu/882731b394937db648de95e50152efb7 to your computer and use it in GitHub Desktop.
Sample kick off script of member list automation process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Apr 18 13:11:43 2018 | |
@author: jeffrey.garcia | |
""" | |
from datetime import datetime | |
from ML_Automation import con_fb | |
from ML_Automation import ml_validation | |
import csv | |
import os | |
import inspect; os.path | |
#Ensure working directory is set to the location of this script | |
filename = inspect.getframeinfo(inspect.currentframe()).filename | |
path = os.path.dirname(os.path.abspath(filename)) | |
os.chdir(path) | |
renamed_columns_data = con_fb() | |
try: | |
long_address_filtered_data = ml_validation(renamed_columns_data) | |
#Export processed data to CSV ready for import to pipeline | |
MLfilename = 'ConFoodbuyMLFinal_' + datetime.now().strftime('%Y%m%d_%H%M%S') + '.csv' | |
long_address_filtered_data.to_csv(MLfilename, index=False) | |
except Exception as e: | |
errorinfo = [] | |
errorinfo.append(str(e) + datetime.now().strftime(', %m/%d/%Y_%H%M%S')) | |
error_log_filename = 'ConFoodbuyMLErrorLog.csv' | |
with open(error_log_filename, 'a') as errorlog: | |
mywriter = csv.writer(errorlog) | |
mywriter.writerows([errorinfo]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment