Hello!

On Tue, Nov 10, 2009 at 2:23 PM, Pierre GM <pgmdevl...@gmail.com> wrote:

>
> On Nov 10, 2009, at 1:09 PM, Darryl Wallace wrote:
>
> > Hello again,
> >
> > The best way so far that's come to my attention is to use:
> >
> > numpy.ma.masked_object
>
> Will only work for masking one specific string, as you've noticed.
> >
> > Can anyone help me so that all strings are found in the array without
> having to explicitly loop through them in Python?
>
> This looks like it's working:
> >>> mask = (mixed >= '')
> >>> mixed = ma.array(np.where(~mask,mixed,np.nan),mask=mask,dtype=float)
>

This method worked the best and fastest.
Thanks for your help on this one :)

>
> > On Fri, Nov 6, 2009 at 3:56 PM, Darryl Wallace <
> darryl.wall...@prosensus.ca> wrote:
> > What I'm doing is importing some data from excel and sometimes there are
> strings in the worksheet.
>
> Now, what are you using to read the Excel file ? Do you get a list that you
> transform into an array, or an ndarray straightaway ?


It depends, I will use Excel if it's available otherwise I will use XLRD.
 Using win32com, excel returns a tuple of tuples from the range that is
selected.  XLRD returns a list of lists.  To keep things consistent I return
a numpy array straight away.

darryl
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to