[Numpy-discussion] Trim a numpy array in numpy.
Hongchun Jin
hongchunjin@gmail....
Tue Aug 16 16:19:07 CDT 2011
*Hi there,
*
*
*
*I have a question regarding how to trim a string array in numpy. *
*
*
*>>> import numpy as np*
*>>> x = np.array(['aaa.hdf', 'bbb.hdf', 'ccc.hdf', 'ddd.hdf'])*
*
*
*I expect to trim a certain part of each element in the array, for example
'.hdf', giving me ['aaa', 'bbb', 'ccc', 'ddd']. Of course, I can do a loop
thing. However, in my actual dataset, I have more than one million elements
in such an array. So I am wondering is there a faster and better way to do
it, like STRMID function in IDL? I try to google it, but it turns out that
I can not find any discussion about it. Thanks. *
*
Hongchun*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110816/8d77d1ff/attachment.html
More information about the NumPy-Discussion
mailing list