-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Fix unicode repr object #459
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
Conversation
You have test failures on Py3 (see travis logs). |
Should be okay now. |
def test_unicode_object_array(): | ||
import sys | ||
if sys.version_info[0] >= 3: | ||
expected = "array(['é'], dtype=object)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether we care, but if it's desireable to keep the source files as ascii, I think this line could be written
expected = u"array(['\xe9'], dtype=object)"
and work on both py2 and py3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err, that's if we're running stuff through 2to3. If not then we can leave off the u
at the beginning and I believe it should still work (though be slightly more confusing).
Any reason not to merge this? Lost track of the release schedule, but it'd be great to get this in if possible. |
I thought maybe others would comment on the bit about including raw unicode characters in source files, but apparently not, and the tests pass, so hey. |
Backported in #2842. |
It's been non-functional for the past 8 years (xref numpy#459)
If you try to print an array with unicode in it and an object dtype, it currently fails. This happens often for me working with pandas because it defaults to the object dtype for non-numerical arrays. This is because the fallback for the formatting is str. Is there any reason not to use the numpystr function here that can handle unicode?
Reproduce