enter image description here
I am trying to insert a table into the document using values from the DF to populate the table cells. I have 2 columns in the DF that are of interest: Operators and Titer
I need to make a table that has a column for Operator and a column for Titer, using the data from the DF.
The attached images are the code errors and code. I’ve tried this using OQDF_F[‘Operators’] instead of OQDF_F[‘Operators’].tolist() and received the same error. I used .tolist() thinking maybe the index was throwing the function off…
Code also here for simplicity sake:
Operators = (OQDF_F['Operators']).tolist()
Titer = (OQDF_F['Titer']).tolist()
records1 = (
(Operators),
(Titer)
)
table2 = document.add_table(rows = 1, cols = 2)
hdr_cells = table2.rows[0].cells
hdr_cells[0].text = 'Operators'
hdr_cells[1].text = 'Titer'
for Operators, Titer in records1:
row_cells = table2.add_row().cells
row_cells[0].text = Operators
row_cells[1].text = Titer
ExoThink is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.