# Configure DataFrame show

**URL:** https://discourse.julialang.org/t/configure-dataframe-show/51593
**Category:** General Usage
**Tags:** dataframes
**Created:** [December 10, 2020, 8:09am UTC](https://discourse.julialang.org/t/configure-dataframe-show/51593 "2020-12-10T08:09:54Z")
**Posts on this page:** 1
**Showing post:** 5

<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: [December 10, 2020, 2:20pm UTC](https://discourse.julialang.org/t/configure-dataframe-show/51593/5 "2020-12-10T14:20:03Z")

</div>

This is not ideal, but I think you can tweak the following code to meet your needs:

```julia
function dfshow(df, num_printed_rows, max_str)
    rows, cols = size(df)
    display_rows, display_cols = displaysize(stdout)

    # Compute the size of the `Row` column.
    row_size = floor(Int, log10(rows)) + 1 + 2

    num_cols_per_line = floor(Int, (display_cols - row_size)/(max_str+2))
    num_cols_per_line == 0 && (num_cols_per_line = 1)

    col_beg = 1
    col_end = clamp(num_cols_per_line, 0, cols)

    while true
        show(view(df, :, col_beg:col_end),
             truncate = max_str,
             display_size = (num_printed_rows + 8, display_cols))
        println()

        col_beg = col_end + 1

        col_end == cols && break

        col_end = clamp(col_end + num_cols_per_line, 0, cols)
    end
end

```

 ![Captura de Tela 2020-12-10 às 11.14.43](https://global.discourse-cdn.com/julialang/original/3X/1/d/1d15793ce8d1214be7afec26c7f0e539a8514daa.png)

 ![Captura de Tela 2020-12-10 às 11.15.30](https://global.discourse-cdn.com/julialang/original/3X/c/7/c7ac05bf75c2eba94157a9d5607d24628e187be5.png)

 ![Captura de Tela 2020-12-10 às 11.17.08](https://global.discourse-cdn.com/julialang/original/3X/2/4/24ae67b09252a937ccbf0eaabc0865b7f1e2658e.png)

Just three notes:

1. There is probably 100 ways to write a better code than I did 😃
2. The complicated part is to compute the size of the printed table. I think I need to add a function in PrettyTables to return such sizes. It will help a lot.
3. If the column width is lower than `max_str`, then there will be a lot of empty space in the line.

---

_[View the full topic](https://discourse.julialang.org/t/configure-dataframe-show/51593)._
