# Replace where condition

**URL:** <https://community.konduit.ai/t/replace-where-condition/1488>\
**Category:** ND4J\
**Created:** [July 9, 2021, 8:17pm UTC](https://community.konduit.ai/t/replace-where-condition/1488 "2021-07-09T20:17:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wcneill](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/wcneill/32/559_2.png) [@wcneill](https://community.konduit.ai/u/wcneill)\
**Post date:** [July 9, 2021, 8:17pm UTC](https://community.konduit.ai/t/replace-where-condition/1488/1 "2021-07-09T20:17:54Z")

</div>

Is there a `Condition` that works for elementwise comparison of two INDArrays?

Essentially I have want to compare two arrays, and replace any entries that are not equal with zero.

This would be something like:

```auto
data.replaceWhere(
      Nd4j.valueArrayOf(data.shape, replacement).castTo(DataType.DOUBLE),
      Conditions.lessThan(epsilon)
)

```

Except comparing each point to a single value, we compare it to the same index in a different array.

---

<div class="post-metadata">

**Author:** ![wcneill](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/wcneill/32/559_2.png) [@wcneill](https://community.konduit.ai/u/wcneill)\
**Post date:** [July 10, 2021, 12:03am UTC](https://community.konduit.ai/t/replace-where-condition/1488/2 "2021-07-10T00:03:15Z")

</div>

I think I fumbled my way to an answer:

1. Use a mask created with `data.match(comp, condition)`
2. Use that mask with `data.putWhereWithMask(mask, replacementData)`

I found out the hard way that these operations are in place.
