INNER CODE UNIT · Python
add_df_to_docx_table
StaPH-B/docker-builds · build-files/cbird-util/2.0/plain_report.py:36
def add_df_to_docx_table(doc, df):
table = doc.add_table(rows=df.shape[0] + 1, cols=df.shape[1])
# Add the header rows.
for j, col in enumerate(df.columns):
table.cell(0, j).text = str(col)
# Add the data rows.
for i in range(df.shape[0]):
for j in range(df.shape[1]):
table.cell(i + 1, j).text = str(df.iat[i, j])
table.style = 'Light List'
def report(date, labid, taxon, percent, amr_df, point_df, disclaimer, logo1, logo2, line1, line2, line3, line4, line5, line6):
# Create a new Document
doc = Document()