tompollard / tableone

Create "Table 1" for research papers in Python
https://pypi.python.org/pypi/tableone/
MIT License
161 stars 38 forks source link

[feature request] Allow for a title. #71

Closed shahzeb1 closed 6 years ago

shahzeb1 commented 6 years ago

screen shot 2018-08-15 at 11 12 43 am

Currently I am just editing the HTML but I think it would be neat to be able to pass in a title="something" so that a title can be added to the HTML output.

I'd be willing to work on this PR if you'd like this feature.

alistairewj commented 6 years ago

My opinion is sticking to modifying/customizing the table makes sense, but not much outside of it, so I'm not really sure it's worth it. We'd have to support writing titles in all the potential output formats (CSV, Markdown, HTML) - which right now is passed off to the pandas library.

jraffa commented 6 years ago

FWIW, the R version prints (a) column title(s) like this only when you dump the result to console using the default print method. When you do this it displays some tab delimited version of the table1 object. afaik it is handled natively by the package, and cannot be directly changed from whatever the default is.

I usually use the knitr's kable function which can dump the table to html, latex, markdown, etc, and you can do what you're asking for with it. I guess that's a long way of saying I agree with Alistair, it's better to let another library handle this.

I don't use pandas very often, but it appears to have lots of options:

https://pandas.pydata.org/pandas-docs/stable/style.html

Let us know if we can make them more accessible or easier to use,

shahzeb1 commented 6 years ago

Totally understand. That's what I figured since it's hard to give "titles" to CSV's or Markdown files. It would just end up being an HTML specific thing, so you're right, it wouldn't make too much sense.

I think for now it's smart just to stick purely to the table and allow the user to edit things outside the table by themselves (like I just added a <h1> title to the HTML output).