I am trying to perform multiple operations on each element in a large list (>10000 elements). For example, my list L1 has x,y,z coordinates
L1 = [[1.23,4.55,5.66],[3.23,-8.55,3.66],[5.73,2.35,55.16]]
I wish to convert each element into a single string concatenated by single decimal floats of each of the three points. So for the above list, I wish to create a new list L2
L2 = ['1.24.65.7','3.2-8.63.7','5.72.455.2']
I tried the following two obvious methods using simple for loop and list comprehension. Both the methods took more than 8 minutes to run. I am posting this question to inquire about a much faster approach.
#Method1
final = []
for point in points:
x,y,z = point[0],point[1],point[2]
final.append(str(round(x,1))+str(round(y,1))+str(round(z,1)))
#Method2
final = [str(round(i[0],1))+str(round(i[1],1))+str(round(i[2],1)) for i in points]