# PrettyTables; DataFrames: Combination

**URL:** <https://discourse.julialang.org/t/prettytables-dataframes-combination/31674>\
**Category:** Visualization\
**Tags:** dataframes, prettytables\
**Created:** [November 29, 2019, 9:33pm UTC](https://discourse.julialang.org/t/prettytables-dataframes-combination/31674 "2019-11-29T21:33:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Usor](https://avatars.discourse-cdn.com/v4/letter/u/8dc957/32.png) [@Usor](https://discourse.julialang.org/u/Usor)\
**Post date:** [November 29, 2019, 9:33pm UTC](https://discourse.julialang.org/t/prettytables-dataframes-combination/31674/1 "2019-11-29T21:33:17Z")

</div>

If you do this

```julia
#df is some DataFrame
#pipe the first 10 rows to be formatted with PrettyTables
first(df, 10) |> pretty_table

```

you get the expected outcome.

But I seek (e.g.) this:

```julia
#pick first 10 rows, print with PrettyTables without borders (and so on)
first(df, 10) |> pretty_table(tf = borderless)

```

Is there some syntax recommended?

---

<div class="post-metadata">

**Author:** ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Post date:** [November 30, 2019, 6:40am UTC](https://discourse.julialang.org/t/prettytables-dataframes-combination/31674/2 "2019-11-30T06:40:12Z")

</div>

> [@Usor](#):
>
> tf = borderless)

```julia
julia> map(x->round(x,digits=2),rand(4,2)) 
4×2 Array{Float64,2}:
 0.27 0.37
 0.42 0.37
 0.35 0.15
 0.38 1.0 

julia> map(x->round(x,digits=2),rand(4,2)) |> pretty_table
┌────────┬────────┐
│ Col. 1 │ Col. 2 │
├────────┼────────┤
│ 0.9 │ 0.6 │
│ 0.85 │ 0.09 │
│ 0.09 │ 0.61 │
│ 0.77 │ 0.14 │
└────────┴────────┘

julia> map(x->round(x,digits=2),rand(4,2)) |> x->pretty_table(x,tf = borderless)

  Col. 1 Col. 2  
                   
    0.18 0.71  
    0.84 0.72  
    0.95 0.0  
    0.35 0.89  

```

---

<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 30, 2019, 1:47pm UTC](https://discourse.julialang.org/t/prettytables-dataframes-combination/31674/3 "2019-11-30T13:47:55Z")

</div>

There seems to be some confusion about julia’s `|>` vs R’s `%>%`.

R’s `%>%` transforms things so that `x %>% f(y)` is equivalent to `f(x, y)`. Julia’s `|>` operator doesn’t work like that, one reason that choice was made is because Julia doesn’t place the same emphasis on the first argument of functions the way the tidyverse ecosystem does.

the poster above gives a good example, you could also use Pipe.jl or a similar package.

```julia
using Pipe
julia> @pipe first(df, 10) |> pretty_table(_, tf = borderless)

```

---

<div class="post-metadata">

**Author:** ![Usor](https://avatars.discourse-cdn.com/v4/letter/u/8dc957/32.png) [@Usor](https://discourse.julialang.org/u/Usor)\
**Post date:** [November 30, 2019, 2:38pm UTC](https://discourse.julialang.org/t/prettytables-dataframes-combination/31674/4 "2019-11-30T14:38:48Z")

</div>

Alright. Thanks, both.
