mail.python.org
[Tutor] inserting a vector into an array - numpy Q
More information about the Tutor mailing list.
More information about the Tutor mailing list.
tempDATA=[] for i in sequence: tempDATA.append(expr(i)). Code in this form can become the list comprehension.You can also have multiple loops in a single list comp; if you wanted a single list of floats, instead of a list of lists, you could write.
I wish to convert it to a numpy array of floats. How do I accomplish this?More information about the Tutor mailing list.
Here is an example to demonstrate my problem (using numpy to avoid needing an image file, and to make it easier to show the results in text; you could instead use a 4x4 image and the .show() method of Image to see what I'm talking about)