Merge Numpy Array To Single Int
How can a numpy array like this: [10, 22, 37, 45] be converted to a single int32 number like this: 10223745
Solution 1:
This could work:
>>> int(''.join(map(str, [10, 22, 37, 45])))
10223745
Basically you use map(str, ...)
to convert that array of integers to string, then ''.join
to concatenate each of those strings, and finally int
to convert the whole thing to an integer.
Post a Comment for "Merge Numpy Array To Single Int"