Created
August 18, 2020 18:24
-
-
Save shaan-shah/dfc51a2988964f42564baf1ca63dbf2b to your computer and use it in GitHub Desktop.
This was made to demonstrate code on medium.
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
@start_new_thread | |
def send_mail_final(target_variable,df_train,df_test,email_id,message,date_column=None): | |
try: | |
df_pred=auto_predictor(Target_Variable=target_variable,data_raw=df_train,n_valid=int(0.1*len(df_train)),data_to_predict=df_test,date_column=date_column) | |
df_pred=pd.DataFrame(df_pred) | |
df_pred.to_csv('predictions.csv') | |
recepient = email_id | |
email=EmailMessage('Processed Data',message,EMAIL_HOST_USER,[recepient]) | |
email.attach_file('predictions.csv') | |
email.attach_file('Feature Importance.png') | |
xyz=1 | |
except: | |
message='Something went wrong ! Please try again after checking all the fields.' | |
recepient = email_id | |
email=EmailMessage('Processed Data',message,EMAIL_HOST_USER,[recepient]) | |
xyz=0 | |
if xyz : | |
os.remove('predictions.csv') | |
os.remove('Feature Importance.png') | |
#email.attach(files_send.name, files_send.read(), files_send.content_type) | |
email.send() | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment