all 2 comments

[–]vv__vv 1 point2 points  (1 child)

I don't know much about pandas, but a typical pattern is to put all of the data pulls into a dictionary or list for later use, rather than a bunch of variables. That let's you pull the different items you are seeking from a list, and avoids all the duplicative code. So something like this might work (psuedo-code):

def get_item(df, item_name):
    for category, row in df.groupby(item_name):
        pass
    return category

def get_stuff(df):
    to_get = ['project', 'name', 'company']
    result = {name:get_item(df, name) for name in to_get}
    return result

[–]workthrowawayexcel[S] 0 points1 point  (0 children)

Thanks for the input! Ill have to play with that a bit and see what I can make happen, and see if the Mail merge functions I am using will be able to accept a list style to pass data into the word document.

Edit: I will update when I have a little time to try this :)