# Merge two dataframes together

**URL:** <https://discourse.julialang.org/t/merge-two-dataframes-together/50137>\
**Category:** Data\
**Created:** [November 14, 2020, 12:04pm UTC](https://discourse.julialang.org/t/merge-two-dataframes-together/50137 "2020-11-14T12:04:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorrp1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lorrp1/32/17647_2.png) [@lorrp1](https://discourse.julialang.org/u/lorrp1)\
**Post date:** [November 14, 2020, 12:04pm UTC](https://discourse.julialang.org/t/merge-two-dataframes-together/50137/1 "2020-11-14T12:04:20Z")

</div>

Hello, im trying merging or joining 2 dataframe on the same index.  
i have just checked this page [Joins · DataFrames.jl](https://juliadata.github.io/DataFrames.jl/stable/man/joins/) and it seems all the join require the name of a column, but id like to use the index instead of column.

if it was possible to use something like:  
join (df,df, on: index/row)

edit: merge!() seems to be perfect but its deprecated…

---

<div class="post-metadata">

**Author:** ![johnmyleswhite](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnmyleswhite/32/31_2.png) [@johnmyleswhite](https://discourse.julialang.org/u/johnmyleswhite)\
**Post date:** [November 14, 2020, 12:18pm UTC](https://discourse.julialang.org/t/merge-two-dataframes-together/50137/2 "2020-11-14T12:18:09Z")

</div>

What does index mean? You’re treating these DataFrames like arrays? If so, can you use hcat?

```julia
julia> using DataFrames

julia> x = DataFrame(a = [2, 3])
2×1 DataFrame
│ Row │ a │
│ │ Int64 │
├─────┼───────┤
│ 1 │ 2 │
│ 2 │ 3 │

julia> y = DataFrame(b = [3, 4])
2×1 DataFrame
│ Row │ b │
│ │ Int64 │
├─────┼───────┤
│ 1 │ 3 │
│ 2 │ 4 │

julia> hcat(x, y)
2×2 DataFrame
│ Row │ a │ b │
│ │ Int64 │ Int64 │
├─────┼───────┼───────┤
│ 1 │ 2 │ 3 │
│ 2 │ 3 │ 4 │

```
