I have also been updating a Word file using the Python doc-x library and building tables etc into this file. Now I would like to add the results of the IF function.
if any(df.loc[df.loc[:,'Column A'] =='Y']):
print (df.loc[:,'Value'] + "\n Placeholder A \nPlaceholder B\n" + str(table))
else:
print (df.loc[:,'Value'] + "\n Placeholder A \nPlaceholder B \n")
Any ideas on how I can achieve this? Currently, it is only printing the desired result to the console.
I have already tried using
doc.add_paragraph()
But there is no way to add in the conditional statement through this.
Aucun commentaire:
Enregistrer un commentaire