# Joining two DataFrames with same columns

**URL:** <https://discourse.julialang.org/t/joining-two-dataframes-with-same-columns/5671>\
**Category:** Data\
**Created:** [September 1, 2017, 12:35pm UTC](https://discourse.julialang.org/t/joining-two-dataframes-with-same-columns/5671 "2017-09-01T12:35:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IljaK91](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iljak91/32/44301_2.png) [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Post date:** [September 1, 2017, 12:35pm UTC](https://discourse.julialang.org/t/joining-two-dataframes-with-same-columns/5671/1 "2017-09-01T12:35:22Z")

</div>

Hi there,

I would like to join two DataFrames that have the same column, let’s say:

DataFrameA:  
country GDP  
Germany 1

DataFrameB:  
country GDP  
USA 2

The resulting DataFrame should be:  
country GDP  
Germany 1  
USA 2

But through join(DataFrameA,DataFrameB,on = :country, kind= :outer) I get:  
country GDP GDP\_1  
Germany 1 NA  
USA NA 2

Is it just another kind of join or a different command altogether?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![tshort](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tshort/32/43_2.png) [@tshort](https://discourse.julialang.org/u/tshort)\
**Post date:** [September 1, 2017, 1:11pm UTC](https://discourse.julialang.org/t/joining-two-dataframes-with-same-columns/5671/2 "2017-09-01T13:11:32Z")

</div>

I think you want `vcat()` to concatenate your DataFrames.

---

<div class="post-metadata">

**Author:** ![Alec\_Loudenback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alec_loudenback/32/278_2.png) [@Alec\_Loudenback](https://discourse.julialang.org/u/Alec_Loudenback)\
**Post date:** [May 15, 2019, 5:49pm UTC](https://discourse.julialang.org/t/joining-two-dataframes-with-same-columns/5671/3 "2019-05-15T17:49:34Z")

</div>

I also found this answer on StackOverflow for when only a subset of the columns are the same:

```julia
join(df1, df2, kind = :outer, on = intersect(names(df1), names(df2)))

```

[https://stackoverflow.com/a/53747354/371843](https://stackoverflow.com/a/53747354/371843)
