8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Original ticket http://projects.scipy.org/numpy/ticket/1722 on 2011-01-25 by @jseabold, assigned to unknown.
from StringIO import StringIO import numpy as np
data = "1, 2, 3\n4, ,5"
np.genfromtxt(StringIO(data), delimiter=",", names="a,b,c", missing_values=" ", filling_values=0) array([(1.0, 2.0, 3.0), (4.0, nan, 5.0)], dtype=[('a', '<f8'), ('b', '<f8'), ('c', '<f8')])
np.genfromtxt(StringIO(data), delimiter=",", names="a,b,c", missing_values={'b':" "}, filling_values={'b' : 0}) array([(1.0, 2.0, 3.0), (4.0, 0.0, 5.0)], dtype=[('a', '<f8'), ('b', '<f8'), ('c', '<f8')])
Unless I use the dict for missing_values, it doesn't fill them in. Without named columns
np.genfromtxt(StringIO(data), delimiter=",", missing_values=" ", filling_values=0) array([[ 1., 2., 3.], [ 4., nan, 5.]])
np.genfromtxt(StringIO(data), delimiter=",", missing_values={1 :" "}, filling_values={1 :0}) array([[ 1., 2., 3.], [ 4., 0., 5.]])
The text was updated successfully, but these errors were encountered:
This behavior also affects filling_values alone. The default settings for missing_values locates them in all columns, but using a single value filling_values, like filling_values=0 does not work unless the 0 is made a string filling_values="0" http://stackoverflow.com/questions/15144352/numpy-genfromtxt-using-filling-missing-correctly#comment21322447_15144352
filling_values=0
filling_values="0"
Sorry, something went wrong.
Still present in 1.9-devel.
9c76897
Merge pull request #4968 from WarrenWeckesser/bug-genfromtxt
4125912
BUG: io: genfromtxt did not handle filling_values=0 correctly. Closes gh-2317.
BUG: io: genfromtxt did not handle filling_values=0 correctly. Closes n…
8b58d98
…umpygh-2317.
No branches or pull requests
Original ticket http://projects.scipy.org/numpy/ticket/1722 on 2011-01-25 by @jseabold, assigned to unknown.
from StringIO import StringIO
import numpy as np
data = "1, 2, 3\n4, ,5"
np.genfromtxt(StringIO(data), delimiter=",", names="a,b,c",
missing_values=" ", filling_values=0)
array([(1.0, 2.0, 3.0), (4.0, nan, 5.0)],
dtype=[('a', '<f8'), ('b', '<f8'), ('c', '<f8')])
np.genfromtxt(StringIO(data), delimiter=",", names="a,b,c",
missing_values={'b':" "}, filling_values={'b' : 0})
array([(1.0, 2.0, 3.0), (4.0, 0.0, 5.0)],
dtype=[('a', '<f8'), ('b', '<f8'), ('c', '<f8')])
Unless I use the dict for missing_values, it doesn't fill them in.
Without named columns
np.genfromtxt(StringIO(data), delimiter=",", missing_values=" ",
filling_values=0)
array([[ 1., 2., 3.],
[ 4., nan, 5.]])
np.genfromtxt(StringIO(data), delimiter=",", missing_values={1 :" "},
filling_values={1 :0})
array([[ 1., 2., 3.],
[ 4., 0., 5.]])
The text was updated successfully, but these errors were encountered: