I am using the Zenodo REST API to upload data and I would like to include a table in the description
. The website states description
attribute can be html
.
My metadata is stored in a pandas dataframe, so I first tried using the to_html()
function.
import pandas as pd
df = pd.DataFrame(['metadata', 'to', 'publish'], index=['a', 'b', 'c'], columns=['item1'])
df.to_html(header=False)
This output string is filled with many, many carriage returns (not sure why) and this does not work (see here).
'\n \n \n a\n metadata\n \n \n b\n to\n \n \n c\n publish\n \n \n'
This is an example I have tried.
I have tried a number of other options including to_markdown()
and to_string()
but none have worked well.
My question is: how can I format a pandas dataframe as a table that can be displayed in a Zenodo description
?