On Wed, Oct 7, 2009 at 1:20 PM, Christopher Barker <chris.bar...@noaa.gov> wrote: > josef.p...@gmail.com wrote: > >> I wanted to avoid the python loop and thought creating the view will be >> faster >> with large arrays. But for this I need to know the memory length of a >> row of arbitrary types for the conversion to strings, > > ndarray.itemsize > > might do it. > > -Chris
Thanks, (I forgot to reply), it works and feels less low level than strides. Josef >>> tmps2[0].itemsize * np.size(tmps2[0]) 16 >>> tmp[0].itemsize * np.size(tmp[0]) 24 >>> tmps2.strides[0] 16 >>> tmp.strides[0] 24 >>> tmp array([[-1.414, -1.019, -1.171], [-1.273, 1.639, -0.854], [-1.795, -0.699, 0.595], [-0.865, -1.439, -0.275]]) >>> tmps2 array([(4.0, 0, 1), (1.0, 1, 3), (2.0, 2, 4), (4.0, 0, 1)], dtype=[('f0', '<f8'), ('f1', '<i4'), ('f2', '<i4')]) >>> > > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > chris.bar...@noaa.gov > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion