# Concatenate anndata with merged rows

**URL:** <https://discourse.scverse.org/t/concatenate-anndata-with-merged-rows/665>\
**Category:** anndata\
**Created:** [August 5, 2022, 7:56pm UTC](https://discourse.scverse.org/t/concatenate-anndata-with-merged-rows/665 "2022-08-05T19:56:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bcorrie](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@bcorrie](https://discourse.scverse.org/u/bcorrie)\
**Post date:** [August 5, 2022, 7:56pm UTC](https://discourse.scverse.org/t/concatenate-anndata-with-merged-rows/665/1 "2022-08-05T19:56:15Z")

</div>

I have two anndata objects read in from two different sources:

```auto
       prop1 prop2 prop3
cell1 1.0 0.0 1.0
cell2 0.0 2.0 0.0

```

```auto
       prop4 prop5 prop6
cell4 4.0 0.0 0.0
cell5 0.0 5.0 0.0
cell1 0.0 0.0 1.0

```

Essentially information for cells are read in from two different sources but when the obs index/name is the same, they are the same cell (cell1 has prop1, prop3, and prop6).

I want to concatenate these and where I have the same cell observation index I want to merge the two rows. anndata.concat() doesn’t seem to do this at least using any of the parameters that I tried. The concatenate does what I want, but there doesn’t seem to be any way to merge the two ‘cell1’ rows together. I get this:

```auto
       prop1 prop2 prop3 prop4 prop5 prop6
cell1 1.0 0.0 1.0 0.0 0.0 0.0
cell2 0.0 2.0 0.0 0.0 0.0 0.0
cell4 0.0 0.0 0.0 4.0 0.0 0.0
cell5 0.0 0.0 0.0 0.0 5.0 0.0
cell1 0.0 0.0 0.0 0.0 0.0 1.0

```

What I want is this:

```auto
       prop1 prop2 prop3 prop4 prop5 prop6
cell1 1.0 0.0 1.0 0.0 0.0 1.0
cell2 0.0 2.0 0.0 0.0 0.0 0.0
cell4 0.0 0.0 0.0 4.0 0.0 0.0
cell5 0.0 0.0 0.0 0.0 5.0 0.0

```

Am I missing something? This seems like it should be easy (yes, relatively new to AnnData).

Brian
