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
npyio.loadtxt is bytes-casting text file input, even with str dtype specified. #2715
Comments
I also have that issue. This is very very annoying; basically you can't use loadtxt in Python3. Temporary solution: I removed all asbytes() calls in the loadtxt method. |
Yeah, I remember thinking something was fishy in there when I looked through the code. |
For the record, I am running into the same issue with datetime64 inputs, leading to a parsing error of the form:
This would be fine in production code but is highly non-pretty for training material... |
Pushing off to 1.11. |
work-around - run iconv on the file first. |
pushing off to 1.12. |
I see that this is being pushed forward, but I find that is is a bug that should be addressed, and a fix seems to be easily implemented. |
Pretty shocking that this hasn't been fixed for 5 years |
It looks as though this is working as desired in NumPy 1.13.3 (though I'm not sure which PR fixed it). Can this issue be closed?
|
Closing. Please reopen if needed. |
Environment
When calling
numpy.loadtxt
on file containing strings as follows:Where NYSE_dates.txt is simply a list of dates (could be anything really):
Output is:
As you can see, all the strings have been bytes-casted, then stringified through
conv
, as you would get the same result fromstr(str('12/31/2020').encode('latin1'))
, perconv
&compat.asbytes
.After looking at the code, it appears that all strings are bytes-casted with
asbytes(...)
pretty much throughout, as for example insplit_line(...)
, so this must mean every routine in the module is broken.The text was updated successfully, but these errors were encountered: