diff options
author | pierregm <pierregm@localhost> | 2009-10-14 19:43:00 +0000 |
---|---|---|
committer | pierregm <pierregm@localhost> | 2009-10-14 19:43:00 +0000 |
commit | 4b6137af35397b349c1eb651d044e0dd245901cc (patch) | |
tree | 1dee1844d7ab1ade4f16983d8d9582400a686452 /numpy/lib/_iotools.py | |
parent | bbe934c2cf3fb3faf7e6ff798b7518f9637917a1 (diff) | |
download | numpy-4b6137af35397b349c1eb651d044e0dd245901cc.tar.gz |
* _iotools.StringConverter
- prevents a `default` of 0 to be overwritten during initialization
- allows the `missing_values` to be a comma-separated string
* io.genfromtxt
- `usecols` can now be a single integer
- for `usecols` and `names` to list (for compatibility w/ Python 2.5)
- negative values in `usecols` are properly transformed to positive integers
- fixed `usecols` with named columns
Diffstat (limited to 'numpy/lib/_iotools.py')
-rw-r--r-- | numpy/lib/_iotools.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py index 398ed07a4..c69bd84dc 100644 --- a/numpy/lib/_iotools.py +++ b/numpy/lib/_iotools.py @@ -535,7 +535,10 @@ class StringConverter: for (i, (deftype, func, default_def)) in enumerate(self._mapper): if np.issubdtype(ttype, deftype): _status = i - self.default = default or default_def + if default is None: + self.default = default_def + else: + self.default = default break if _status == -1: # We never found a match in the _mapper... @@ -552,6 +555,8 @@ class StringConverter: if missing_values is None: self.missing_values = set(['']) else: + if isinstance(missing_values, basestring): + missing_values = missing_values.split(",") self.missing_values = set(list(missing_values) + ['']) # self._callingfunction = self._strict_call |