summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
Commit message (Collapse)AuthorAgeFilesLines
...
* DOC: Add some docstrings and edit others.Charles Harris2017-11-211-15/+27
| | | | | | | Add docstrings for some of the support functions in _datasource and npyio in order to aid future maintainers. [ci skip]
* ENH: Add encoding option to numpy text IO.Julian Taylor2017-11-211-100/+246
| | | | | | | | | | | This modifies loadtxt and genfromtxt in several ways intended to add unicode support for text files by adding an `encoding` keyword to np.load, np.genfromtxt, np.savetxt, and np.fromregex. The original treatment of the relevant files was to open them as byte files, whereas they are now opened as text files with an encoding. When read, they are decoded to unicode strings for Python3 compatibility, and when written, they are encoded as specified. For backward compatibility, the default encoding in both cases is latin1.
* DOC: Clarify behavior of genfromtxt names fieldDavid Freese2017-10-241-5/+6
| | | | | | | | | The documentation on the name parameter for npyio.genfromtxt uses the phrase "valid line" which doesn't completely describe it's behavior. This updates the documentation on the names field to indicate the first line, with or without a comment delimeter, will be taken for the names field. fixes #9878
* DOC: Unindent enumeration in savetxt docstringAndras Deak2017-10-211-4/+4
| | | | | | The rendered markdown in the online documentation was broken due to the one-character indentation added in the multiline enumerations of the docstring of savetxt.
* ENH: Save to ZIP files without using temporary files.Serhiy Storchaka2017-10-151-22/+33
| | | | | Since Python 3.6 it is possible to write directly to a ZIP file, without creating temporary files.
* ENH Better error message for savetxt when X.ndim > 2Nelle Varoquaux2017-09-201-2/+5
| | | | | savetxt does not support saving arrays of dimension 0 or higher than 2. This pull request improves the message of the error raised.
* Updates order of parameters in save docstring to match function parameter orderJames Bourbeau2017-08-301-2/+2
|
* MAINT/DOC: Use builtin when np.{x} is builtins.{x}.Eric Wieser2017-08-051-7/+7
| | | | | | | This is the case for x in {int, bool, str, float, complex, object}. Using the np.{x} version is deceptive as it suggests that there is a difference. This change doesn't affect any external behaviour. The `long` type is missing in python 3, so np.long is still useful
* MAINT: Fix alerts from http://lgtm.com (#9292)Jean Helie2017-06-261-1/+1
| | | | | | | * make exception raising 2/3 compatible * remove unnecesary else statement after while loop without break clause * ensure file is always enclosed even in the event of an exception * ensure list comprehension variable does not override enclosing loop variable
* BUG: KeyboardInterrupt is swallowed all over the placeEric Wieser2017-06-031-1/+1
| | | | Bare except is very rarely the right thing
* MAINT: Remove asbytes where a b prefix would sufficeEric Wieser2017-03-251-9/+9
| | | | | | | | Since we only need to support python 2, we can remove any case where we just pass a single string literal and use the b prefix instead. What we can't do is transform asbytes("tests %d" % num), because %-formatting fails on bytes in python 3.x < 3.5.
* MAINT: Rename function to prevent name-shadowingEric Wieser2017-03-231-3/+4
| | | | | This file had two functions called flatten_dtype, which did similar but different things.
* MAINT: replace len(x.shape) with x.ndimEric Wieser2017-02-241-1/+1
|
* DOC: Add example to np.savez_compressedMartin Thoma2017-01-151-6/+44
|
* BUG: Apply more robust string converts in loadtxtgfyoung2016-12-081-2/+2
| | | | | | | | | | The original dtype converters for bytes and str did not account for converting objects of str or bytes dtype respectively. Replace the original converters with those from numpy.compat, which are much more robust. Closes gh-8033.
* Merge pull request #7987 from f0k/advertise-open_memmapCharles Harris2016-10-281-0/+1
|\ | | | | DOC: See also np.load and np.memmap in np.lib.format.open_memmap
| * DOC: Hint at lib.format.open_memmap from np.load and np.memmapJan Schlüter2016-08-291-0/+1
| | | | | | | | | | | | | | np.load supports memmap_mode to open existing .npy files as memory-mapped files. np.memmap supports creating or loading raw binary files as memory-mapped files. This adds a link to a function for creating memory-mapped files in .npy format.
* | DOC: Minor spelling fix in genfromtxt() docstring.wrwrwr2016-10-181-1/+1
| | | | | | | | Closes #8166.
* | DOC: change Numpy to NumPy in dosctrings and commentsPierre de Buyl2016-09-061-5/+5
| | | | | | | | The strings in error messages were left untouched
* | ENH: Add stacklevel to all (or almost all) our function callsSebastian Berg2016-09-021-3/+3
|/
* DOC: fix typo in documentation of loadtxt (closes #7878)dunneff2016-07-281-1/+1
|
* DOC: fix typo in savetxt docstring (closes #7620)bertrand2016-06-101-1/+1
|
* STY: Misc whitespace cleanup.Erik M. Bray2016-05-311-4/+4
|
* BUG: Fixes to reading and writing of empty arrays, and in particular arrays ↵Erik M. Bray2016-05-311-1/+3
| | | | with empty dtypes. See #6430
* ENH: Add support for pathlib.Path objects to save/load functionsWendell Smith2016-04-061-14/+39
|
* Merge pull request #7133 from yarikoptic/bf-savezNathaniel J. Smith2016-02-091-1/+7
|\ | | | | savez: temporary file alongside with target file and improve exception message upon IOError
| * BF: Since savez could be used with BytesIO - check if file is a stringYaroslav Halchenko2016-01-281-2/+2
| |
| * ENH: catch and rethrow exception in _savez upon IOError with filename infoYaroslav Halchenko2016-01-271-0/+2
| |
| * ENH: for savez create temporary file alongside with the target fileYaroslav Halchenko2016-01-271-1/+5
| | | | | | | | Closes: gh-5336
* | ENH: usecols now accepts an int when only one column has to be readI--P2016-02-011-5/+30
|/
* DOC: Cleanup genfromtxt documentation a bit.Charles Harris2015-10-041-8/+7
|
* DOC: Update docs for numpy.genfromtxt.jason king2015-10-041-3/+5
| | | | | | | Note that a list of strings can be passed as the first parameter. The strings are treated as the lines in a file. Closes #6247
* BUG: fix #4381: precision loss on string -> longdouble conversionAnne Archibald2015-08-281-0/+2
| | | | | | | | | | | | | | | Avoid going through python floats when converting string to longdouble. This makes it dramatically easier to produce full-precision long double numbers. Fixed are the constructor (np.longdouble("1.01")), np.fromfile, np.fromstring, np.loadtxt, and np.genfromtxt (and functions based on it). Also fixed is precision loss when using np.tofile. This also fixes #1481, poor handling of bad data in fromfile and fromstring. If the function strtod_l is not available, almost none of this will work, and many tests will fail.
* DOC: Fix docstring warnings in documetation generation.Charles Harris2015-07-011-0/+1
| | | | | | | | | | | | Most of these fixes involve putting blank lines around .. versionadded:: x.x.x and .. deprecated:: x.x.x Some of the examples were also fixed.
* MAINT: remove legacy monkeypatching of GzipFileNathaniel J. Smith2015-06-241-49/+2
| | | | | | | | | | I'm not sure exactly when GzipFile.seek started supporting the whence= argument by default -- sometime around python 2.5 from the looks of http://bugs.python.org/issue1355023. But in any case it was definitely there by 2.6, which is now the earliest version we support, so there's no longer any need to monkeypatch it in. This also fixes an error in python 3.5b2, which I haven't bothered to track down further because these are the wages of monkeypatching.
* DOC: Fix examples in npyio.py to properly import StringIO.Charles Harris2015-06-211-2/+2
| | | | | | | | | | | | In two places they were doing >>> from StringIO import StringIO Since Python 2.6 that should be >>> from io import StringIO Closes #5995.
* DEP,MAINT: Remove keywords "skiprows" and "missing" from genfromtxt.Charles Harris2015-06-211-32/+9
| | | | | Deprecated in NumPy 1.5. If this causes problems in the 1.10 release cycle the change can be reverted.
* DEP: Add notes to some deprecations.Charles Harris2015-06-211-2/+2
| | | | | Some keywords are deprecated and slated for removal in numpy 2.0. Add comment to deprecation date to clarify that.
* MAINT: Mark deprecation warning with a date and Numpy version.Charles Harris2015-06-211-0/+2
| | | | | | This is to make it easier to find and remove deprecated features. It would be a good idea if all deprecations were made with similar comments.
* Merge pull request #4612 from Nodd/loadtxt_commentsCharles Harris2015-04-231-7/+15
|\ | | | | ENH: Multiple comment tokens in loadtxt
| * ENH: Multiple comment tokens in loadtxtJoseph Martinot-Lagarde2015-04-221-7/+15
| |
* | ENH: add options for disabling use of pickle in load/savePauli Virtanen2015-04-181-8/+36
|/
* BUG: loadtxt fails with complex data in Python 3.Charles Harris2015-03-111-2/+7
| | | | | | | | | | | The problem is that the Python complex type constructor only accepts a pair of numbers or a string, unlike other numeric types it does not work with byte strings. The numpy error is subtle, as loadtxt opens the file in the default text mode, but then converts the input lines to byte strings when they are split into separate values. The fix here is to convert the values back to strings in the complex converter. Closes #5655.
* STY: fold long linesPauli Virtanen2015-03-081-6/+8
|
* BUG: enable working around pickle compatibility issues on Py3 in npy filesPauli Virtanen2015-03-081-10/+58
| | | | | | Add pickle compatibility flags to numpy.save and numpy.load. Allow only combinations that cannot corrupt binary data in Numpy arrays. Use the same default values as Python pickle.
* DOC: Reconcile docstrings and function signatures where they disagreeRobert McGibbon2015-03-021-2/+2
| | | | | Fixed typos in docstrings were updated for functions where the parameter names in the docstring didn't match the function signature.
* ENH: Add support for float hex format to loadtxt.Chris Laumann2015-02-131-1/+12
| | | | | | | | Add _floatconv to npyio.py as a default floating point converter. This uses float() as a type conversion with a fallback on (ValueError) to float.fromhex(). Closes #2517.
* Merge pull request #5495 from charris/cleanup-gh-4649Charles Harris2015-01-241-1/+5
|\ | | | | BUG: Fix genfromtext NameValidator arguments passed to easy_dtype.
| * BUG: Fix genfromtext NameValidator arguments passed to easy_dtype.Alan Briolat2015-01-231-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | np.genfromtxt validates field names twice: once in genfromtxt and once in easy_dtype. Whilst the arguments to genfromtxt are used in the first validation, they aren't passed to easy_dtype (which is used only when dtype != None) and therefore in this case the default validation (strip non-alphanum, replace spaces) gets confusingly applied, ignoring genfromtxt's arguments. This patch adds fixes genfromtxt by passing the appropriate arguments onwards to easy_dtype. That is probably the least invasive way to fix the issue.
* | Merge pull request #5496 from charris/cleanup-gh-5103Charles Harris2015-01-241-3/+21
|\ \ | | | | | | ENH:Add keyword max_rows to genfromtxt.