# Eliminate NaN tuples from dictionary

**URL:** <https://discourse.julialang.org/t/eliminate-nan-tuples-from-dictionary/29329>\
**Category:** General Usage\
**Created:** [September 30, 2019, 3:14pm UTC](https://discourse.julialang.org/t/eliminate-nan-tuples-from-dictionary/29329 "2019-09-30T15:14:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rasoul](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@Rasoul](https://discourse.julialang.org/u/Rasoul)\
**Post date:** [September 30, 2019, 3:14pm UTC](https://discourse.julialang.org/t/eliminate-nan-tuples-from-dictionary/29329/1 "2019-09-30T15:14:25Z")

</div>

Hi All,

I want to eliminate (NaN, NaN) tuple form the blow dictionary. Can you please let me know how I can do this. Thanks in advance!

intersection[(6, 9)]=Any[(1.0, -0.295491), (0.866025, -0.34202), (0.866025, -0.34202), (0.866025, 0.642788), (0.866025, 0.642788), (0.866025, 0.642788), (1.0, 0.642788), (NaN, NaN)]

intersection[(4, 12)]=Any[(1.0, -0.295491), (0.866025, -0.34202), (0.866025, -0.34202), (0.866025, 0.642788), (0.866025, 0.642788), (0.866025, 0.642788), (1.0, 0.642788), (NaN, NaN)]

intersection[(10, 17)]=Any[(1.0, 0.0347929), (0.987629, 0.0170758), (0.987629, 0.0170758), (0.629613, 0.347077), (0.629613, 0.874437), (0.629613, 0.874437), (0.649382, 0.874437), (1.0, 0.551255)]

intersection[(15, 23)]=Any[(1.0, 0.114635), (0.997958, 0.110388), (0.997958, 0.110388), (0.554297, 0.366488), (0.554297, 0.915927), (0.554297, 0.915927), (0.558678, 0.915927), (1.0, 0.661177)]

intersection[(23, 24)]=Any[(1.0, 0.110281), (0.997629, 0.105457), (0.997629, 0.105457), (0.558419, 0.365825), (0.558419, 0.913925), (0.558419, 0.913925), (0.56341, 0.913925), (1.0, 0.65511)]

All the best,  
Rasoul

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [September 30, 2019, 3:35pm UTC](https://discourse.julialang.org/t/eliminate-nan-tuples-from-dictionary/29329/2 "2019-09-30T15:35:22Z")

</div>

You can use `all(isnan, t)` or `any(isnan, t)` to check whether all or any elements of a tuple `t` are `NaN` respectively. I recommend using this togeher with `filter` or `filter!`. Check the doc string for those functions using `?filter` in the REPL to find out more.

For example, on each value you can do

```julia
filter!(t -> !any(isnan, t), v)

```
