How to hide the types line when printing a data frame

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, but without going through PrettyPrinting.jl, and keeping it as a DataFrame. Is this possible?

1 Like

You are already going through PrettyTables when using DataFrames:

https://github.com/JuliaData/DataFrames.jl/blob/main/src/DataFrames.jl#L10

1 Like

Perhaps you could use display() as follows:

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

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

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.

For maximum prettiness, use the included PrettyTables

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 :slight_smile:

The table looks good now :smiley: Here is the current look, for anyone interested:
image

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.