Hello!<br><br><div class="gmail_quote">On Tue, Nov 10, 2009 at 2:23 PM, Pierre GM <span dir="ltr"><<a href="mailto:pgmdevlist@gmail.com">pgmdevlist@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
On Nov 10, 2009, at 1:09 PM, Darryl Wallace wrote:<br>
<br>
> Hello again,<br>
><br>
> The best way so far that's come to my attention is to use:<br>
><br>
> numpy.ma.masked_object<br>
<br>
</div>Will only work for masking one specific string, as you've noticed.<br>
<div class="im">><br>
> Can anyone help me so that all strings are found in the array without having to explicitly loop through them in Python?<br>
<br>
</div>This looks like it's working:<br>
>>> mask = (mixed >= '')<br>
>>> mixed = ma.array(np.where(~mask,mixed,np.nan),mask=mask,dtype=float)<br></blockquote><div><br></div><div>This method worked the best and fastest.  </div><div>Thanks for your help on this one :)</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im"><br>
> On Fri, Nov 6, 2009 at 3:56 PM, Darryl Wallace <<a href="mailto:darryl.wallace@prosensus.ca">darryl.wallace@prosensus.ca</a>> wrote:<br>
> What I'm doing is importing some data from excel and sometimes there are strings in the worksheet.<br>
<br>
</div>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 ?</blockquote><div><br></div><div>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.</div>
<div><br></div><div>darryl</div></div>