diff options
author | Warren Weckesser <warren.weckesser@gmail.com> | 2014-08-15 19:24:37 -0400 |
---|---|---|
committer | Warren Weckesser <warren.weckesser@gmail.com> | 2014-08-15 19:26:56 -0400 |
commit | 9c7689794cf59fc0065da8bba1d97002c7be14e3 (patch) | |
tree | 938d16dd7e38fbe573432304f5927ce95de5c41f /numpy/lib/tests/test_io.py | |
parent | 50a1dfa08698aa3406085944d5007d99388c8a06 (diff) | |
download | numpy-9c7689794cf59fc0065da8bba1d97002c7be14e3.tar.gz |
BUG: io: genfromtxt did not handle filling_values=0 correctly. Closes gh-2317.
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r-- | numpy/lib/tests/test_io.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index 03e238261..40a229d14 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -1300,6 +1300,16 @@ M 33 21.99 ctrl = np.array([(0, 3), (4, -999)], dtype=[(_, int) for _ in "ac"]) assert_equal(test, ctrl) + data2 = "1,2,*,4\n5,*,7,8\n" + test = np.genfromtxt(TextIO(data2), delimiter=',', dtype=int, + missing_values="*", filling_values=0) + ctrl = np.array([[1, 2, 0, 4], [5, 0, 7, 8]]) + assert_equal(test, ctrl) + test = np.genfromtxt(TextIO(data2), delimiter=',', dtype=int, + missing_values="*", filling_values=-1) + ctrl = np.array([[1, 2, -1, 4], [5, -1, 7, 8]]) + assert_equal(test, ctrl) + def test_withmissing_float(self): data = TextIO('A,B\n0,1.5\n2,-999.00') test = np.mafromtxt(data, dtype=None, delimiter=',', |