# Print all columns of a dataframe

**URL:** <https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520>\
**Category:** General Usage\
**Tags:** dataframes\
**Created:** [January 22, 2018, 11:22am UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520 "2018-01-22T11:22:30Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![sam81](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sam81/32/1736_2.png) [@sam81](https://discourse.julialang.org/u/sam81)\
**Post date:** [January 22, 2018, 11:22am UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/1 "2018-01-22T11:22:30Z")

</div>

The latest version of the DataFrames package omits columns that don’t fit the screen when printing. Is there a way to print all columns of a dataframe? Can this be made the default behavior on a given user’s system?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 22, 2018, 11:31am UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/2 "2018-01-22T11:31:04Z")

</div>

```julia
julia> df = DataFrame((Symbol('a' + i) => [i] for i in 0:25)...)
1×26 DataFrames.DataFrame. Omitted printing of 6 columns
│ Row │ a │ b │ c │ d │ e │ f │ g │ h │ i │ j │ k │ l │ m │ n │ o │ p │ q │ r │ s │ t │
├─────┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
│ 1 │ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │

julia> showall(df)
1×26 DataFrames.DataFrame
│ Row │ a │ b │ c │ d │ e │ f │ g │ h │ i │ j │ k │ l │ m │ n │ o │ p │ q │ r │ s │ t │ u │ v │ w │ x │ y │ z │
├─────┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
│ 1 │ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │

```

---

<div class="post-metadata">

**Author:** ![sam81](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sam81/32/1736_2.png) [@sam81](https://discourse.julialang.org/u/sam81)\
**Post date:** [January 22, 2018, 11:42am UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/3 "2018-01-22T11:42:24Z")

</div>

Thanks I didn’t know about this function. Unfortunately, however, the formatting is not very nice when using `showall`, the printout becomes unreadable with dataframes with many rows (I also tried `showall(head(df))` to limit the number of rows but the columns seem all misaligned). The previous (before v0.11) DataFrames version had a much nicer formatting that showed all columns by default.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 22, 2018, 11:43am UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/4 "2018-01-22T11:43:22Z")

</div>

> [@sam81](#):
>
> the printout becomes unreadable with dataframes with many rows

An MWE would help clarify this.

---

<div class="post-metadata">

**Author:** ![sam81](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sam81/32/1736_2.png) [@sam81](https://discourse.julialang.org/u/sam81)\
**Post date:** [January 22, 2018, 12:10pm UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/5 "2018-01-22T12:10:46Z")

</div>

```julia
df = DataFrame((Symbol('a' + i) => rand(10) for i in 0:100)...)
showall(df)

```

The old dataframe behavior was to print `n` rows of all the columns that fit the screen and then print `n` rows of the remaining columns. `showall` prints a row with ‘carriage return’ for all columns, then another row for all columns etc…, which becomes difficult to read.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 22, 2018, 1:12pm UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/6 "2018-01-22T13:12:01Z")

</div>

I see. Looking at the source code, you can get back the old behavior with

```julia
julia> show(df, true)
1×26 DataFrames.DataFrame
│ Row │ a │ b │ c │ d │ e │ f │ g │ h │ i │ j │ k │ l │ m │ n │ o │ p │ q │ r │ s │ t │
├─────┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤
│ 1 │ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │

│ Row │ u │ v │ w │ x │ y │ z │
├─────┼────┼────┼────┼────┼────┼────┤
│ 1 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │

```

---

<div class="post-metadata">

**Author:** ![sam81](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sam81/32/1736_2.png) [@sam81](https://discourse.julialang.org/u/sam81)\
**Post date:** [January 22, 2018, 1:30pm UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/7 "2018-01-22T13:30:04Z")

</div>

that’s great, thanks!

---

<div class="post-metadata">

**Author:** ![bramtayl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bramtayl/32/3614_2.png) [@bramtayl](https://discourse.julialang.org/u/bramtayl)\
**Post date:** [January 24, 2018, 1:37am UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/8 "2018-01-24T01:37:57Z")

</div>

Maybe this is a bug?

---

<div class="post-metadata">

**Author:** ![umberto\_jr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/umberto_jr/32/18313_2.png) [@umberto\_jr](https://discourse.julialang.org/u/umberto_jr)\
**Post date:** [September 30, 2020, 1:48pm UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/9 "2020-09-30T13:48:29Z")

</div>

In case someone ends up here first:

[Getting Started · DataFrames.jl](https://juliadata.github.io/DataFrames.jl/stable/man/getting_started/) says

> You can override this behavior by changing the values of the `ENV["COLUMNS"]` and `ENV["LINES"]` variables to hold the maximum width and height of output in **characters** respectively.

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [May 10, 2022, 3:53pm UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/10 "2022-05-10T15:53:32Z")

</div>

The correct way now seems to be:

```julia
show(df, allcols=true)

```

---

<div class="post-metadata">

**Author:** ![Felipe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/felipe/32/42888_2.png) [@Felipe](https://discourse.julialang.org/u/Felipe)\
**Post date:** [November 21, 2022, 10:30am UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/11 "2022-11-21T10:30:19Z")

</div>

Just to add, one mightt want something like

> show(first(df,5), allcols=true)

---

<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:** [November 21, 2022, 2:15pm UTC](https://discourse.julialang.org/t/print-all-columns-of-a-dataframe/8520/12 "2022-11-21T14:15:53Z")

</div>

[TerminalPager.jl](https://github.com/ronisbr/TerminalPager.jl) is also really helpful here.
