# Copy rdataframe column into another rdataframe

**URL:** <https://root-forum.cern.ch/t/copy-rdataframe-column-into-another-rdataframe/53969>\
**Category:** Newbie\
**Tags:** rdataframe, root\
**Created:** [March 10, 2023, 7:25pm UTC](https://root-forum.cern.ch/t/copy-rdataframe-column-into-another-rdataframe/53969 "2023-03-10T19:25:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lilina](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/lilina/32/28468_2.png) [@lilina](https://root-forum.cern.ch/u/lilina)\
**Post date:** [March 10, 2023, 7:25pm UTC](https://root-forum.cern.ch/t/copy-rdataframe-column-into-another-rdataframe/53969/1 "2023-03-10T19:25:51Z")

</div>

Hi!

I have two different dataframes with the same number of entries. How can I copy one column of the dataframe 1 into the dataframe 2?

Many thanks!

---

<div class="post-metadata">

**Author:** ![lilina](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/lilina/32/28468_2.png) [@lilina](https://root-forum.cern.ch/u/lilina)\
**Post date:** [March 10, 2023, 9:13pm UTC](https://root-forum.cern.ch/t/copy-rdataframe-column-into-another-rdataframe/53969/2 "2023-03-10T21:13:49Z")

</div>

I don’t know if there is a better way but I found a solution using Take:

```auto
auto nptsCol = df1.Take<int>("npoints");
auto df3 = df2.Define("npoints", [&nptsCol](ULong64_t iset){return nptsCol->at(iset);}, {"rdfentry_"});

```
