I’d like to display a dataframe without secondary header of types in jupyter cell output but can not figure out how to do it. My best attempt prints HTML that I want but does not render it.
df = DataFrame(a=1:2, b=3:4)
show(stdout, MIME("text/html"), df; eltypes=false)
PrettyTables.jl has a
nosubheader option for this.
You can just do
show(df; nosubheader = true).
DataFrame forwards keyword arguments to
This gives a result in plain text which does not look as good
This works but renders with a different theme for some reason
The reason is that
show for data frame has a custom theme.
The issue is that by default
display is used to show things in Jupyter Notebook.
@Ronis_BR - in Use PrettyTables.jl as HTML backend by ronisbr · Pull Request #3096 · JuliaData/DataFrames.jl · GitHub I think we should make sure that users can properly customize displaying of data frames in Jupyter Notebooks. OK?
In the released version, PrettyTables is not used to render HTML. It will be available when that PR mentioned by @bkamins is merged. This is the reason why you are seeing a different theme when using PrettyTables (side note: this default print will change in the next release of PrettyTables).
In this PR, we already have the possibility to pass any argument to PrettyTables just as the text backend so that the user can customize the output:
For future reference, I have found that I can use
HTML() to render with my original code
iobuf = IOBuffer()
show(iobuf, MIME("text/html"), df; eltypes=false)