0
Python iterating through array of floats
pointArray contains floats in form [[x1 y1 z1][x2 y2 z2]...[xn yn zn]] for point in pointArray xVal, yVal, zVal = tuple(point[0]) Returns TypeError: ‘float’ object is not iterable
8 Respostas
+ 8
But I think the problem is:
xVal, yVal, zVal, = tuple (point[0])
use
xVal, yVal, zVal, = tuple(point)
or just
xVal, yVal, zVal, = point
because point[0] is a float and a float cannot be converted to a tuple (a tuple is an iterable)
+ 4
Please provide the full code
+ 4
Then provide a code snippet, with actual values not variable names
+ 4
[[x1,y1,z1],[x2,y2,z2],.....]
+ 1
That would be tricky, there is a lot of it and the issue is in this section.
+ 1
I’ll check that, Yerucham. I was reusing some old code, processing points now.
+ 1
That worked, thanks! I remember now that the tuple was there to preserve some structure from another library and so isn’t necessary here.
0
If you’re curious: www.github.com/AcrimoniousMirth/Project-Adam-3D-SCANNER-CODE :)