[Numpy-discussion] using loadtxt to load a text file in to a numpy array
chris.barker at noaa.gov
Thu Jan 23 14:45:40 EST 2014
On Thu, Jan 23, 2014 at 11:18 AM, <josef.pktd at gmail.com> wrote:
> I think this is just inconsistent casting rules in numpy,
> numpy should either refuse to assign the wrong type, instead of using
> the repr as in some of the earlier examples of Oscar
> >>> s = np.inf
> >>> np.array((s,), dtype=int) == s
> Traceback (most recent call last):
> File "<pyshell#126>", line 1, in <module>
> np.array((s,), dtype=int) == s
> OverflowError: cannot convert float infinity to integer
> or use the **same** conversion/casting rules also during the
> interaction with python as are used in assignments and array creation.
Exactly -- but what should those conversion/casting rules be? We can't
decide that unless we decide if 'S' is for text or for arbitrary bytes --
it can't be both. I say text, that's what it's mostly trying to do already.
But if it's bytes, fine, then some things still need cleaning up, and we
could really use a one-byte-text type. and if it's text, then we may need
a bytes dtype.
Key here is that we don't have the option of not breaking anything,
because there is a lot already broken.
Christopher Barker, Ph.D.
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.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion