Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add table id option to pandas.DataFrame.to_html #8496
I'm using the pandas.DataFrame.to_html() method to generate a table to embed into a a templated document which references the table via an id. It would be useful if pandas.DataFrame.to_html() supported a
I'm not sure my py skills are up to contributing code but if I can abstract anything from use cases I come across I'll add them in to an appropriate thread.
Something that comes to mind in terms of generalisation is how to cope with outputting metadata, either about the dataframe itself, or additional to the dataframe in terms of presentation (for example, the id attribute for the table, or column layout information etc).
The ONS (Office of National Statistics) in the UK have started experimenting with the Tabular Data Package format which bundles a JSON file carrying metadata about the contents of one or more CSV files with those files packaged alongside it.
I've been wondering what a pandas
(How to make effective use of all the metadata when doing a
It seems to me that there are perhaps three sorts of metadata that need addressing in outputs:
I was also looking for the same feature because I'm using Flask and want to output a DataFrame as HTML and have a nice formatting using a JS library for table. So I will need to refer to a given id in my JS code.
Having just an id parameter will help.
I understand the wish for a more general solution but it will be a pragmatic solution
Here is my own version (to support for example escape parameter also)