-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
genfromtxt with names=True doesn't work with python3 #5411
New issue
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
Comments
I've tested this a bit on my own arch linux install, and it seems that this has to do with how python3 handles bytestrings and your use of
"Note that generators must return byte strings in Python 3k." I suspect that Solution
Or for a more interactive experience, you can have it print a string to the console first:
|
Thanks @nigeil for your comment, but that solves a different problem. I want to call my program as
That way I don't need to bother with the filename in python. |
Ah, I see the difference. Darned python3. You could replicate the functionality you're looking for with my solution by instead passing a file containing only the filename of the data file - but that is pretty lame. If you find a solution, please share it! |
With Python 3.3.2 and numpy 1.8, I can reproduce your error, and get it to work using |
Thanks @jaimefrio. |
Yes, I think I agree: it seems like an important shortcoming in Python 3 support. That said, I don't know that code enough to understand what the implications would be. My general feeling is that numpy's read-from-file functionality needs a serious overhaul to bring it up to the standard that pandas has set, and I am not sure that small incremental changes will take us there. But PRs are always welcome! ;-) |
Fixed in 1.14 |
See cython/cython#5411, which is now resolved for Cython>3 and we are at Cython>=3.0.6.
This commit performs the following: 1. Skip `RuntimeWarnings` on exotic `np.where()` tests on WASM because of the lack of floating point exception support 2. Skip NumPy config tests that use subprocess module on WASM 3. Ignore threaded tests for PRNGs on WASM 4. Remove numpygh-5411 Cython `AttributeError` check. See cython/cython#5411, which is now resolved for Cython>3, and we are at Cython>=3.0.6. 4. For f2py, check compilers only if not on WASM 5. Skip pickle serialisation tests for `stringdtype` on WASM runtimes
This commit performs the following: 1. Skip `RuntimeWarnings` on exotic `np.where()` tests on WASM because of the lack of floating point exception support 2. Skip NumPy config tests that use subprocess module on WASM 3. Ignore threaded tests for PRNGs on WASM 4. Remove numpygh-5411 Cython `AttributeError` check. See cython/cython#5411, which is now resolved for Cython>3, and we are at Cython>=3.0.6. 4. For f2py, check compilers only if not on WASM 5. Skip pickle serialisation tests for `stringdtype` on WASM runtimes
This commit performs the following: 1. Skip `RuntimeWarnings` on exotic `np.where()` tests on WASM because of the lack of floating point exception support 2. Skip NumPy config tests that use subprocess module on WASM 3. Ignore threaded tests for PRNGs on WASM 4. Remove numpygh-5411 Cython `AttributeError` check. See cython/cython#5411, which is now resolved for Cython>3, and we are at Cython>=3.0.6. 4. For f2py, check compilers only if not on WASM 5. Skip pickle serialisation tests for `stringdtype` on WASM runtimes
Uh oh!
There was an error while loading. Please reload this page.
Using python 3.4.2 on Arch Linux with numpy 1.9.1, the following code doesn't work:
When running with a simple input file, it gives the following error:
The input file can be constructed with:
There is no problem with python2.
The text was updated successfully, but these errors were encountered: