Skip to content

Instantly share code, notes, and snippets.

@shaan-shah
Created August 18, 2020 18:24
Show Gist options
  • Save shaan-shah/dfc51a2988964f42564baf1ca63dbf2b to your computer and use it in GitHub Desktop.
Save shaan-shah/dfc51a2988964f42564baf1ca63dbf2b to your computer and use it in GitHub Desktop.
This was made to demonstrate code on medium.
@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