In [2]:
import pandas as pd
import random

In [47]:
excuses = pd.read_csv('data/excuse.csv')
# excuses.head()

In [73]:
excuses_dict = excuses.to_dict('records')
# excuses_dict

In [72]:
def excuse_sentence(name, location):
    randomly_chosen_excuse = random.choice(excuses_dict)
    sentence = "Sorry, " + name + ", I'm late to meeting you at " + location + ", " + randomly_chosen_excuse['excuse'] + ". To make up for being late, here's something to read while you are waiting " + randomly_chosen_excuse['hyperlink']
    return sentence

excuse_sentence(input("Please type the name of the person you planned to meet:"), input("Tell me where you planned to meet:"))


Please type the name of the person you planned to meet:Georgia and Harsha
Tell me where you planned to meet:Hungarian Pastry Shop
Out[72]:
"Sorry, Georgia and Harsha, I'm late to meeting you at Hungarian Pastry Shop, I should have gotten myself moving quicker. To make up for being late, here's something to read while you are waiting http://www.dnainfo.com/new-york/20141112/rockaway-park/de-blasio-arrives-20-minutes-late-flight-587-memorial-angering-families"

In [ ]: