Revision c76e4b13-ecc1-49c5-9ca0-910a7fc3749f - Stack Overflow
You can use [`zip()`](https://docs.python.org/3/library/functions.html#zip) to zip together each list and each sublist to compare them element-wise:
> Make an iterator that aggregates elements from each of the iterables.
> Returns an iterator of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables. [...].
>>> def max_value(lst1, lst2):
for subl1, subl2 in zip(lst1, lst2):
for el1, el2 in zip(subl1, subl2):
yield max(el1, el2)
>>>
>>> a=[[2,4],[6,8]]
>>> b=[[1,7],[5,9]]
>>>
>>> list(max_value(a, b))
[2, 7, 6, 9]
If using NumPy, you can use [`numpy.maximum()`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.maximum.html#numpy-maximum):
> Element-wise maximum of array elements.
> Compare two arrays and returns a new array containing the element-wise maxima. [...].
>>> import numpy as np
>>>
>>> a = np.array([[2,4],[6,8]])
>>> b = np.array([[1,7],[5,9]])
>>>
>>> np.maximum(a, b)
array([[2, 7],
[6, 9]])
>>>