[Numpy-discussion] numpy scalars and savez -- bug?
Chris Barker - NOAA Federal
Thu Apr 18 10:31:23 CDT 2013
On Thu, Apr 18, 2013 at 4:04 AM, Robert Kern <firstname.lastname@example.org> wrote:
> np.save() and company (and the NPY format itself) are for arrays, not
> for scalars. np.save() uses an np.asanyarray() to coerce its input
> which is why your scalar gets converted to a rank-zero array.
Fair enough -- so a missing feature, not bug -- I'll need to look at
the docs and see if that can be clarified - I note that it never
dawned on me to pass anything other than an array in (like a list),
but I guess if I did, it would likely work, but return an array when
re-loaded. I'm ambivalent about whether I like this feature -- in this
case, it resulted in confusion. If I'd gotten an exception in the
first place, it would have been simple enough to fix, as it was it
took some poking around.
As for numpy scalars -- would it be a major lift to support them directly?
> Robert Kern
> NumPy-Discussion mailing list
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
More information about the NumPy-Discussion