diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2011-04-02 14:36:14 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2011-04-02 14:36:14 -0600 |
commit | 5e8e8eda6527e7f8765e905b221bf4477d5f446c (patch) | |
tree | dc74838a8c4703a48e45e81c6ec0306ebf0be79c /numpy/lib/_iotools.py | |
parent | 5d5266cbf90c352251ccf5d72a2a2eba7fe235b5 (diff) | |
download | numpy-5e8e8eda6527e7f8765e905b221bf4477d5f446c.tar.gz |
BUG: ticket #1428, allow int64 and uint64 integer types to be specified in
genfromtxt.
Diffstat (limited to 'numpy/lib/_iotools.py')
-rw-r--r-- | numpy/lib/_iotools.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py index 0bef8e5b9..dec0f5a27 100644 --- a/numpy/lib/_iotools.py +++ b/numpy/lib/_iotools.py @@ -600,9 +600,15 @@ class StringConverter: # If the input was a dtype, set the function to the last we saw if self.func is None: self.func = func - # If the status is 1 (int), change the function to smthg more robust + # If the status is 1 (int), change the function to + # something more robust. if self.func == self._mapper[1][1]: - self.func = lambda x : int(float(x)) + if issubclass(ttype, np.uint64): + self.func = np.uint64 + elif issubclass(ttype, np.int64): + self.func = np.int64 + else: + self.func = lambda x : int(float(x)) # Store the list of strings corresponding to missing values. if missing_values is None: self.missing_values = set([asbytes('')]) |