If you do not need to keep the original values in the arrays, then you could use numpy.nan_to_num() with copy=False to modify the second array in the tuple in-place. This has the advantage of not creating new arrays.
The following example replaces the second array of every tuple in Coeff with zeros.
import numpy as np
Coeff = [
tuple(np.full((5, ), np.nan) for i in range(2))
for j in range(5)
]
print(Coeff)
nil = [np.nan_to_num(tup[1], copy=False) for tup in Coeff]
print(Coeff)
The output is
[
(array([nan, nan, nan, nan, nan]), array([nan, nan, nan, nan, nan])),
(array([nan, nan, nan, nan, nan]), array([nan, nan, nan, nan, nan])),
(array([nan, nan, nan, nan, nan]), array([nan, nan, nan, nan, nan])),
(array([nan, nan, nan, nan, nan]), array([nan, nan, nan, nan, nan])),
(array([nan, nan, nan, nan, nan]), array([nan, nan, nan, nan, nan]))
]
[
(array([nan, nan, nan, nan, nan]), array([0., 0., 0., 0., 0.])),
(array([nan, nan, nan, nan, nan]), array([0., 0., 0., 0., 0.])),
(array([nan, nan, nan, nan, nan]), array([0., 0., 0., 0., 0.])),
(array([nan, nan, nan, nan, nan]), array([0., 0., 0., 0., 0.])),
(array([nan, nan, nan, nan, nan]), array([0., 0., 0., 0., 0.]))
]
If you only need the work with the first tuple, you could use nil = np.nan_to_num(Coeff[0][1], copy=False). Note that I use nil to indicate you do not need the result of the function.