From: Travis N. V. <tr...@en...> - 2006-06-06 18:55:56
|
I'd like to construct an array of tuples and I'm not sure how (without looping). Is there a quick way to do this with dtype? I've tried: >>> import numpy >>> x = [(1,2,3),(4,5,6)] >>> numpy.array(x) array([[1, 2, 3], [4, 5, 6]]) >>> numpy.array(x, dtype='p') array([[1, 2, 3], [4, 5, 6]]) >>> numpy.array(x, dtype='O') array([[1, 2, 3], [4, 5, 6]], dtype=object) Thanks, Travis |