Python: List comprehension list of lists
So far I have seen that list comprehension works really well for matrices and even tuple sublists:
x = [[1,2,3],[4,5,6],[7,8,9]]
yet I do not think I have seen a good solution to the uneven sublist situation:
x = [[[[34, 21], [20, 21],[24, 212],[20, 21],[16, 12],[840, 190],[-406, 188],[-410, 185]],[[220, 204],[229, 167],[234, 100],[231, 150],[236, 156],[232, 1362],[254, 196],[256, 962],[258, 878],[254, 776],[264, -50],[271, -410]],[[2326, 1984],[2412, 1958],[2540, 1896],[4506, 869]]]]
How would I run a function in a manner similar to list comprehension over the tuples that changes and replaces all of their values? Supposing the function to be used as the following:
def tuplFun(x1, y1):
a = x1 / 2 * 30.0 - 80.0
b = math.atan(math.sinh(math.pi * (1 - 2 * y1 / 4)))
return (a, b)
Please pardon if I use the incorrect terminology since I am not a regular developer or programmer. This is a matter of understanding the limitations of list comprehensions and the proper way to address different scenarios that exist within data sets.
Thank you.