[SciPy-User] Masking multiple fields in a structuredtimeseriesobject.

Pierre GM pgmdevlist at gmail.com
Tue Jan 12 15:56:30 EST 2010


On Jan 12, 2010, at 3:33 PM, Dharhas Pothina wrote:
> Thank you, I finally got it. I guess I had difficulty in conceptually treating the series and dates separately. I kept trying to apply the masks using 'series[start:end]' and ended up with my indices mismatching.
> 
> on a related note is there any way to do the following without using a loop?
> 
> _series['name'][1:3] == 'BB'
> 
> right now this gives me 1st and 2nd entries in _series['name'] rather than the 1st and 2nd characters for all entries in _series['name']

_series['name'] is a 1D array w/ dtype '|S3'. What you'd want is to transform it into a 2D array of '|S1'. You could try to look chararray, but I'm not sure it'll help you. I'm afraid you gonna have to stick w/ the for loop. You may get it inlined, though:
 ['BB' in _ for _ in _series['name']]



> thanks.





More information about the SciPy-User mailing list