# Displaying a DataFrame in jupyter without column types

**URL:** <https://discourse.julialang.org/t/displaying-a-dataframe-in-jupyter-without-column-types/86505>\
**Category:** Jupyter-Notebook\
**Tags:** dataframes\
**Created:** [August 29, 2022, 3:29pm UTC](https://discourse.julialang.org/t/displaying-a-dataframe-in-jupyter-without-column-types/86505 "2022-08-29T15:29:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![artemsolod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/artemsolod/32/20704_2.png) [@artemsolod](https://discourse.julialang.org/u/artemsolod)\
**Post date:** [August 29, 2022, 3:29pm UTC](https://discourse.julialang.org/t/displaying-a-dataframe-in-jupyter-without-column-types/86505/1 "2022-08-29T15:29:55Z")

</div>

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.

```julia
using DataFrames
df = DataFrame(a=1:2, b=3:4)
show(stdout, MIME("text/html"), df; eltypes=false)

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/6/d611bb72e453a3ab8cabd9bc5b56ea30321b937d.png)

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [August 29, 2022, 3:38pm UTC](https://discourse.julialang.org/t/displaying-a-dataframe-in-jupyter-without-column-types/86505/2 "2022-08-29T15:38:15Z")

</div>

PrettyTables.jl has a `nosubheader` option for this.

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [August 29, 2022, 3:42pm UTC](https://discourse.julialang.org/t/displaying-a-dataframe-in-jupyter-without-column-types/86505/3 "2022-08-29T15:42:35Z")

</div>

You can just do `show(df; nosubheader = true)`. `show` for `DataFrame` forwards keyword arguments to `pretty_table`

---

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [August 29, 2022, 3:50pm UTC](https://discourse.julialang.org/t/displaying-a-dataframe-in-jupyter-without-column-types/86505/4 "2022-08-29T15:50:44Z")

</div>

The problem is that it is in Jupyter Notebook.

After [Use PrettyTables.jl as HTML backend by ronisbr · Pull Request #3096 · JuliaData/DataFrames.jl · GitHub](https://github.com/JuliaData/DataFrames.jl/pull/3096) using these options will be possible (CC @Ronis_BR)

---

<div class="post-metadata">

**Author:** ![artemsolod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/artemsolod/32/20704_2.png) [@artemsolod](https://discourse.julialang.org/u/artemsolod)\
**Post date:** [August 29, 2022, 3:53pm UTC](https://discourse.julialang.org/t/displaying-a-dataframe-in-jupyter-without-column-types/86505/5 "2022-08-29T15:53:40Z")

</div>

This gives a result in plain text which does not look as good

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/0/b0016064c638ebff427491d77646c59eef7ca02a.png)

---

<div class="post-metadata">

**Author:** ![artemsolod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/artemsolod/32/20704_2.png) [@artemsolod](https://discourse.julialang.org/u/artemsolod)\
**Post date:** [August 29, 2022, 3:58pm UTC](https://discourse.julialang.org/t/displaying-a-dataframe-in-jupyter-without-column-types/86505/6 "2022-08-29T15:58:13Z")

</div>

This works but renders with a different theme for some reason

 ![image](https://global.discourse-cdn.com/julialang/original/3X/9/a/9ab6cf580fe9045f3982f0093ca59a09627f2189.png)

---

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [August 29, 2022, 4:03pm UTC](https://discourse.julialang.org/t/displaying-a-dataframe-in-jupyter-without-column-types/86505/7 "2022-08-29T16:03:47Z")

</div>

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](https://github.com/JuliaData/DataFrames.jl/pull/3096) I think we should make sure that users can properly customize displaying of data frames in Jupyter Notebooks. OK?

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [August 29, 2022, 4:48pm UTC](https://discourse.julialang.org/t/displaying-a-dataframe-in-jupyter-without-column-types/86505/8 "2022-08-29T16:48:04Z")

</div>

Hi @artemsolod,

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).

Hi @bkamins,

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:

 ![Captura de Tela 2022-08-29 às 13.47.33](https://global.discourse-cdn.com/julialang/original/3X/e/d/ed05b7352add7c9f1e5897ecc8c388b3fb3b56a5.png)

---

<div class="post-metadata">

**Author:** ![artemsolod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/artemsolod/32/20704_2.png) [@artemsolod](https://discourse.julialang.org/u/artemsolod)\
**Post date:** [September 9, 2022, 12:41pm UTC](https://discourse.julialang.org/t/displaying-a-dataframe-in-jupyter-without-column-types/86505/9 "2022-09-09T12:41:00Z")

</div>

For future reference, I have found that I can use `HTML()` to render with my original code

```julia
function show_noheader(df)
    iobuf = IOBuffer()
    show(iobuf, MIME("text/html"), df; eltypes=false)
    HTML(String(take!(iobuf)))
end

```

![image](https://global.discourse-cdn.com/julialang/original/3X/a/3/a3e3c8679f71754f84a0e49d2ba76c67ed250244.png)
