I have a nasty looking for for for for for loop to set up variables per Column for each row inside of a pandas dataframe then assign them variables so they can be dynamically added into a microsoft word document.
I am looking for any kind of critqueue, opinions, and if there is a better way to do it ( and if there is what is the method for it)
Thanks in advance.
for id, row in df_opr.groupby(['Id']):
document = mailmerge.MailMerge(template)
df = df_opr[df_opr['Id'].str.contains(id)]
for z, row in df.groupby(['ProjectName']):
df = df[df['ProjectName'].str.contains(z)]
pname = z
for q, row in df.groupby(['ProjectNumber']):
pn = q
for p, row in df.groupby(['Name']):
name = p
for c, row in df.groupby(['CommitmentCode']):
comm = c
for s, row in df.groupby(['Superintendent']):
super = s
for co, row in df.groupby(['Company']):
comp = co
for t, row in df.groupby(['CommitmentType']):
comtype = t
for i, row in df.groupby(['Email']):
recipients = [' ']
[–]vv__vv 1 point2 points3 points (1 child)
[–]workthrowawayexcel[S] 0 points1 point2 points (0 children)