I have a tuple
which contains a numpy.array
of arbitrary length along with scalars. Something like this:
(array([ 31.5, 31.6, 31.7, 31.8, 31.9, 32. , 32.1, 32.2, 32.3,
32.4, 32.5, 32.6, 32.7, 32.8, 32.9, 33. , 33.1, 33.2,
33.3, 33.4, 33.5, 33.6, 33.7, 33.8, 33.9, 34. , 34.1,
34.2, 34.3, 34.4, 34.5, 34.6, 34.7, 34.8, 34.9, 35. ,
35.1, 35.2]), 30.0, 0.0025, 0.0, 0.0027, 0.2791, 1.5, 1.0, 100.0)
My result needs to pair each element of the numpy.array
with all the other elements in the tuple
. Challenge is that the numpy.array
appears in an arbitrary location within the tuple such that I cannot index with a guarantee.
The result needs to be an iterable (preferably a tuple
) of numpy.array
s, something like this:
(array([31.5, 30.0, 0.0025, 0.0, 0.0027, 0.2791, 1.5, 1.0, 100.0]),
array([31.6, 30.0, 0.0025, 0.0, 0.0027, 0.2791, 1.5, 1.0, 100.0]),
array([31.7, 30.0, 0.0025, 0.0, 0.0027, 0.2791, 1.5, 1.0, 100.0]),
array([31.8, 30.0, 0.0025, 0.0, 0.0027, 0.2791, 1.5, 1.0, 100.0]),
...
)
I have tried solutions presented here and here as well as itertools.product
. The SE solutions assume two independent arrays and itertools.product
is not the right solution either.