# How to hide the types line when printing a data frame

**URL:** <https://discourse.julialang.org/t/how-to-hide-the-types-line-when-printing-a-data-frame/72046>\
**Category:** Tooling\
**Tags:** dataframes, prettytables\
**Created:** [November 25, 2021, 8:32am UTC](https://discourse.julialang.org/t/how-to-hide-the-types-line-when-printing-a-data-frame/72046 "2021-11-25T08:32:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [November 25, 2021, 8:32am UTC](https://discourse.julialang.org/t/how-to-hide-the-types-line-when-printing-a-data-frame/72046/1 "2021-11-25T08:32:20Z")

</div>

When a dataframe is printed, I want to hide the line under the column-name that shows the column type. Basically what is shown how to do in [How to hide the types line when pretty printing a data frame](https://discourse.julialang.org/t/how-to-hide-the-types-line-when-pretty-printing-a-data-frame/33393), but without going through `PrettyPrinting.jl`, and keeping it as a `DataFrame`. Is this possible?

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [November 25, 2021, 8:37am UTC](https://discourse.julialang.org/t/how-to-hide-the-types-line-when-printing-a-data-frame/72046/2 "2021-11-25T08:37:45Z")

</div>

You are already going through `PrettyTables` when using DataFrames:

[https://github.com/JuliaData/DataFrames.jl/blob/main/src/DataFrames.jl#L10](https://github.com/JuliaData/DataFrames.jl/blob/main/src/DataFrames.jl#L10)

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [November 25, 2021, 8:47am UTC](https://discourse.julialang.org/t/how-to-hide-the-types-line-when-printing-a-data-frame/72046/3 "2021-11-25T08:47:32Z")

</div>

Perhaps you could use ` display()` as follows:

```julia
using DataFrames
df = DataFrame(rand(4,5),:auto)
display([permutedims(names(df)); Matrix(df)])

  "x1" "x2" "x3" "x4" "x5"
 0.786331 0.284543 0.872459 0.366613 0.447624
 0.571925 0.646146 0.884455 0.529637 0.667295
 0.460681 0.00899394 0.997485 0.0174446 0.987131
 0.107348 0.86024 0.701276 0.289825 0.368326
```

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [November 25, 2021, 12:15pm UTC](https://discourse.julialang.org/t/how-to-hide-the-types-line-when-printing-a-data-frame/72046/4 "2021-11-25T12:15:55Z")

</div>

I had a hunch about that, but from the UI, I am not. What I ment was “Without `using PrettyPrinting`, and commands from it.”

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [November 25, 2021, 12:17pm UTC](https://discourse.julialang.org/t/how-to-hide-the-types-line-when-printing-a-data-frame/72046/5 "2021-11-25T12:17:01Z")

</div>

That is a solution, but the reason I put the data into a DataFrame to begin with was because they look pretty. I simply think that the type information clutters, and I would like to see the output without that extra noise.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [November 25, 2021, 12:33pm UTC](https://discourse.julialang.org/t/how-to-hide-the-types-line-when-printing-a-data-frame/72046/6 "2021-11-25T12:33:36Z")

</div>

For maximum prettiness, use the included PrettyTables

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [November 25, 2021, 12:57pm UTC](https://discourse.julialang.org/t/how-to-hide-the-types-line-when-printing-a-data-frame/72046/7 "2021-11-25T12:57:07Z")

</div>

Alright, when that is my use-case, I should use `PrettyTables` directly. I was expecting it to be harder to use than DataFrames, but it was quite simple 🙂

The table looks good now 😃 Here is the current look, for anyone interested:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/7/5741500f97739b11080c021a838c22fc882221e3.png)

Generated by ` pretty_table(hcat([:Between, :Within, :Total], SS, df, S², [S²[1] / S²[2], "", ""]), header=["Variation", "SS", "df", "S²", "TS"], alignment=:c)`  
Notice the empty strings used to print empty cells in a PrettyTable.
