# \[DataFrames Question\]: Inner join DataFrame Array?

**URL:** <https://discourse.julialang.org/t/dataframes-question-inner-join-dataframe-array/40412>\
**Category:** Data\
**Created:** [May 29, 2020, 1:42pm UTC](https://discourse.julialang.org/t/dataframes-question-inner-join-dataframe-array/40412 "2020-05-29T13:42:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xijiang\_Yu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xijiang_yu/32/14439_2.png) [@Xijiang\_Yu](https://discourse.julialang.org/u/Xijiang_Yu)\
**Post date:** [May 29, 2020, 1:42pm UTC](https://discourse.julialang.org/t/dataframes-question-inner-join-dataframe-array/40412/1 "2020-05-29T13:42:00Z")

</div>

# Question:

Suppose I have an array of DataFrame t[1:10]. What is the neatest way to join them?

```julia-auto
innerjoin(t[1], t[2], ..., on = :tag, ...)
# or
df = t[1]
for i in 2:10 
    df = innerjoin(df, t[i], on =...)
end

```

---

<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 29, 2020, 1:54pm UTC](https://discourse.julialang.org/t/dataframes-question-inner-join-dataframe-array/40412/2 "2020-05-29T13:54:32Z")

</div>

Both are fine! use what you feel is more readable.

I’m not sure which one would be more performant if that is important in this context, but probably the first method.

---

<div class="post-metadata">

**Author:** ![Xijiang\_Yu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xijiang_yu/32/14439_2.png) [@Xijiang\_Yu](https://discourse.julialang.org/u/Xijiang_Yu)\
**Post date:** [May 29, 2020, 2:16pm UTC](https://discourse.julialang.org/t/dataframes-question-inner-join-dataframe-array/40412/3 "2020-05-29T14:16:06Z")

</div>

Thanks. Just realized that the 2nd is better, as number of tables might varies. Using `2:end` can deal array of unknown lengths. It also feels faster, though I didn’t test.

---

<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 29, 2020, 2:17pm UTC](https://discourse.julialang.org/t/dataframes-question-inner-join-dataframe-array/40412/4 "2020-05-29T14:17:32Z")

</div>

You can also use [splatting](https://docs.julialang.org/en/v1/manual/faq/#What-does-the-...-operator-do?-1) for the first method.

```julia
innerjoin(t..., on = :tag)

```

---

<div class="post-metadata">

**Author:** ![Xijiang\_Yu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xijiang_yu/32/14439_2.png) [@Xijiang\_Yu](https://discourse.julialang.org/u/Xijiang_Yu)\
**Post date:** [May 29, 2020, 2:24pm UTC](https://discourse.julialang.org/t/dataframes-question-inner-join-dataframe-array/40412/5 "2020-05-29T14:24:46Z")

</div>

This is exactly what I wanted in the 1st place! Thanks again.
