# Leftjoin order of dataframe

**URL:** <https://discourse.julialang.org/t/leftjoin-order-of-dataframe/61170>\
**Category:** New to Julia\
**Tags:** dataframes\
**Created:** [May 14, 2021, 5:12pm UTC](https://discourse.julialang.org/t/leftjoin-order-of-dataframe/61170 "2021-05-14T17:12:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yogi1](https://avatars.discourse-cdn.com/v4/letter/y/439d5e/32.png) [@yogi1](https://discourse.julialang.org/u/yogi1)\
**Post date:** [May 14, 2021, 5:12pm UTC](https://discourse.julialang.org/t/leftjoin-order-of-dataframe/61170/1 "2021-05-14T17:12:31Z")

</div>

Hi all,

I have updated my DataFrames package from v0.22.5 to v1.1.1.

I have a leftjoin function in my code that is no longer working as expected. The leftjoin function has changed order from the first dataframe.

e.g. leftjoin(dataframe1, dataframe2, on =:column\_header)

Previous to updating my package, the order of the leftjoin was identical to dataframe1.

Does anyone know if it is possible to ensure that the order remains the same as dataframe1?

Thanks in advance!

---

<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:** [May 14, 2021, 5:22pm UTC](https://discourse.julialang.org/t/leftjoin-order-of-dataframe/61170/2 "2021-05-14T17:22:10Z")

</div>

The order is not preserved. This is listed in the docstring of `leftjoin`.

You can `sort` after the `join` to get the preferred ordering.

---

<div class="post-metadata">

**Author:** ![yogi1](https://avatars.discourse-cdn.com/v4/letter/y/439d5e/32.png) [@yogi1](https://discourse.julialang.org/u/yogi1)\
**Post date:** [May 17, 2021, 8:50am UTC](https://discourse.julialang.org/t/leftjoin-order-of-dataframe/61170/3 "2021-05-17T08:50:44Z")

</div>

Thank you! Is this something that changed recently or has this always been the case? Before I updated DataFrames the order of the data was preserved.

---

<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:** [May 17, 2021, 1:15pm UTC](https://discourse.julialang.org/t/leftjoin-order-of-dataframe/61170/4 "2021-05-17T13:15:17Z")

</div>

yes it looks like a 1.0 breaking change. See [here](https://github.com/JuliaData/DataFrames.jl/blob/main/NEWS.md#other-relevant-changes).

---

<div class="post-metadata">

**Author:** ![yogi1](https://avatars.discourse-cdn.com/v4/letter/y/439d5e/32.png) [@yogi1](https://discourse.julialang.org/u/yogi1)\
**Post date:** [May 17, 2021, 1:30pm UTC](https://discourse.julialang.org/t/leftjoin-order-of-dataframe/61170/5 "2021-05-17T13:30:35Z")

</div>

Thank you! 🙂

---

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [May 17, 2021, 1:46pm UTC](https://discourse.julialang.org/t/leftjoin-order-of-dataframe/61170/6 "2021-05-17T13:46:09Z")

</div>

See [https://github.com/JuliaData/DataFrames.jl/issues/2753](https://github.com/JuliaData/DataFrames.jl/issues/2753) for a discussion. If you would like to see improvements in this area please comment there.
