-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Prevent UnicodeDecodeError in pivot_table under Py2 #17489
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
Changes from 4 commits
45e99bf
01991e9
e851082
0d593cb
ce96abd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1625,3 +1625,9 @@ def test_isleapyear_deprecate(self): | |
|
||
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): | ||
assert isleapyear(2004) | ||
|
||
def test_pivot_margins_name_unicode(self): | ||
# issue #13292 | ||
frame = pd.DataFrame({'foo': [1, 2, 3]}) | ||
pd.pivot_table(frame, index=['foo'], aggfunc=len, margins=True, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. still like to compare this here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figured out how to construct the expected object correctly. Please have a look. |
||
margins_name=u'\u0394\u03bf\u03ba\u03b9\u03bc\u03ae') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. get the and compare to a constructed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jreback Could you please suggest what the constructed def test_pivot_margins_name_unicode(self):
# issue #13292
greek = u'\u0394\u03bf\u03ba\u03b9\u03bc\u03ae'
frame = pd.DataFrame({'foo': [1, 2, 3]})
table = pd.pivot_table(frame, index=['foo'], aggfunc=len, margins=True,
margins_name=greek)
expected = pd.DataFrame({}, columns=['foo'], index=[1, 2, 3, greek])
tm.assert_frame_equal(table, expected) This is failing on the last line with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't pass the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestion. This is what I have now: expected = pd.DataFrame(columns=['foo'], index=[1, 2, 3, greek]) It's still failing:
What else could be wrong? |
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.
you don't need the comment, instead change the test name to something useful like:
test_pivot_margins_name_unicode
and put a comment with the issue number