# Passing DataFrame with \`|\>\` to anonymous function changing size?

**URL:** <https://discourse.julialang.org/t/passing-dataframe-with-to-anonymous-function-changing-size/105300>\
**Category:** General Usage\
**Tags:** dataframes, pipelines\
**Created:** [October 23, 2023, 4:21am UTC](https://discourse.julialang.org/t/passing-dataframe-with-to-anonymous-function-changing-size/105300 "2023-10-23T04:21:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hungpham3112](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hungpham3112/32/34315_2.png) [@hungpham3112](https://discourse.julialang.org/u/hungpham3112)\
**Post date:** [October 23, 2023, 4:21am UTC](https://discourse.julialang.org/t/passing-dataframe-with-to-anonymous-function-changing-size/105300/1 "2023-10-23T04:21:29Z")

</div>

What I am doing is redirect the dataset through pipeline operator to show the 6 first lines. There is two difference versions below:

Version 1:  
`train_df_dropped = hcat(select(train_df, Not(:type)), df) first(train_df_dropped, 6)`

Version 2:  
`train_df_dropped = hcat(select(train_df, Not(:type)), df) |> x -> first(x, 6)`

I expected the second version similar to version 1 but it’s not. It’s convert my dataset from `mxn` to `6xn`.

Edit: I found the problem with my code that I need the brackets around equation before redirect it to anonymous function. It seems `|>` operator has higher priority than `=`.

Here is the final code:  
`(train_df_dropped = hcat(select(train_df, Not(:type)), df)) |> x -> first(x, 6)`

---

<div class="post-metadata">

**Author:** ![Sevi](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Sevi](https://discourse.julialang.org/u/Sevi)\
**Post date:** [November 1, 2023, 9:02am UTC](https://discourse.julialang.org/t/passing-dataframe-with-to-anonymous-function-changing-size/105300/2 "2023-11-01T09:02:52Z")

</div>

You already found the solution, but just for reference:  
[https://docs.julialang.org/en/v1/manual/mathematical-operations/#Operator-Precedence-and-Associativity](https://docs.julialang.org/en/v1/manual/mathematical-operations/#Operator-Precedence-and-Associativity)

Assignment `=` indeed has lower precedence than `|>` . I think basically anything of the form

```julia
x = # something

```

will be understood as "first evaluate `# something` and assign the result to `x`.
