[Numpy-discussion] numpy scalars and savez -- bug?

Robert Kern robert.kern at gmail.com
Thu Apr 18 13:13:13 EDT 2013


On Thu, Apr 18, 2013 at 9:20 PM, Chris Barker - NOAA Federal
<chris.barker at noaa.gov> wrote:
> On Thu, Apr 18, 2013 at 8:31 AM, Chris Barker - NOAA Federal
> <chris.barker at noaa.gov> wrote:
>
>> Fair enough -- so a missing feature, not bug -- I'll need to look at
>> the docs and see if that can be clarified -
>
> All I've found is the docstring docs (which also show up in the Sphinx
> docs). I suggest some slight modification:
>
> def save(file, arr):
>     """
>     Save an array to a binary file in NumPy ``.npy`` format.
>
>     Parameters
>     ----------
>     file : file or str
>         File or filename to which the data is saved.  If file is a file-object,
>         then the filename is unchanged.  If file is a string, a ``.npy``
>         extension will be appended to the file name if it does not already
>         have one.
>     arr : array_like
>         Array data to be saved. Any object that is not an array will be
>         converted to an array with asanyarray(). When reloaded, the array
>         version of the object will be returned.
>
>     See Also
>     --------
>     savez : Save several arrays into a ``.npz`` archive
>     savetxt, load
>
>     Notes
>     -----
>     For a description of the ``.npy`` format, see `format`.
>
>     Examples
>     --------
>     >>> from tempfile import TemporaryFile
>     >>> outfile = TemporaryFile()
>
>     >>> x = np.arange(10)
>     >>> np.save(outfile, x)
>
>     >>> outfile.seek(0) # Only needed here to simulate closing & reopening file
>     >>> np.load(outfile)
>     array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>
>     """
>
> I also see:
>
> For a description of the ``.npy`` format, see `format`.
>
> but no idea where to find 'format' -- it looks like it should be a
> link in the Sphinx docs, but it's not.

It does seem to be missing from the docs.

https://github.com/numpy/numpy/blob/master/numpy/lib/format.py

--
Robert Kern



More information about the NumPy-Discussion mailing list