diff --git a/.gitignore b/.gitignore index 26581152fa67..88727bc9c14d 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,7 @@ doc/cdoc/build ###################### .gdb_history .DS_Store? +.DS_Store ehthumbs.db Icon? Thumbs.db diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 44a91c0c7995..0a33c113a02e 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -561,6 +561,12 @@ def _savez(file, args, kwds, compress): zip.close() # Adapted from matplotlib +def _floatconv(x): + try: + return float(x) + except ValueError: + pass + return float.fromhex(x) def _getconv(dtype): typ = dtype.type @@ -573,7 +579,7 @@ def _getconv(dtype): if issubclass(typ, np.integer): return lambda x: int(float(x)) elif issubclass(typ, np.floating): - return float + return _floatconv elif issubclass(typ, np.complex): return complex elif issubclass(typ, np.bytes_):