Skip to content

Commit 1460563

Browse files
committed
Fixed some documentation/formatting issues, clarified the purpose of the test case.
1 parent 257edec commit 1460563

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

doc/source/contributing.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,9 @@ run this slightly modified command::
525525

526526
git diff master --name-only -- '*.py' | grep 'pandas/' | xargs flake8
527527

528-
Note that on Windows, `grep`, `xargs`, and other tools are likely unavailable.
529-
However, this has been shown to work on smaller commits::
528+
Note that on Windows, ``grep``, ``xargs``, and other tools are likely
529+
unavailable. However, this has been shown to work on smaller commits in the
530+
standard Windows command line::
530531

531532
git diff master -u -- "*.py" | flake8 --diff
532533

doc/source/whatsnew/v0.20.3.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Indexing
5151
^^^^^^^^
5252

5353
- Bug in ``Float64Index`` causing an empty array instead of ``None`` to be returned from ``.get(np.nan)`` on a Series whose index did not contain any ``NaN`` s (:issue:`8569`)
54-
- Fixed a bug that prevented joining on a categorical MultiIndex (:issue:`16627`).
5554

5655
I/O
5756
^^^
@@ -79,6 +78,7 @@ Sparse
7978
Reshaping
8079
^^^^^^^^^
8180

81+
- Bug in joining on a ``MultiIndex`` with a ``category`` dtype for a level (:issue:`16627`).
8282

8383

8484
Numeric

pandas/tests/test_join.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,13 @@ def test_merge_join_categorical_multiindex():
207207
'Factor': [1.1, 1.2, 1.3, 1.4, 1.5, 1.6]}
208208
b = DataFrame(b).set_index(['Cat', 'Int'])['Factor']
209209

210-
c = merge(a, b.reset_index(), left_on=['Cat1', 'Int1'],
211-
right_on=['Cat', 'Int'], how='left')
212-
d = a.join(b, on=['Cat1', 'Int1'])
213-
c = c.drop(['Cat', 'Int'], axis=1)
214-
assert_frame_equal(c, d)
210+
expected = merge(a, b.reset_index(), left_on=['Cat1', 'Int1'],
211+
right_on=['Cat', 'Int'], how='left')
212+
result = a.join(b, on=['Cat1', 'Int1'])
213+
expected = expected.drop(['Cat', 'Int'], axis=1)
214+
assert_frame_equal(expected, result)
215215

216+
# Same test, but with ordered categorical
216217
a = {'Cat1': Categorical(['a', 'b', 'a', 'c', 'a', 'b'],
217218
['b', 'a', 'c'],
218219
ordered=True),
@@ -226,8 +227,8 @@ def test_merge_join_categorical_multiindex():
226227
'Factor': [1.1, 1.2, 1.3, 1.4, 1.5, 1.6]}
227228
b = DataFrame(b).set_index(['Cat', 'Int'])['Factor']
228229

229-
c = merge(a, b.reset_index(), left_on=['Cat1', 'Int1'],
230-
right_on=['Cat', 'Int'], how='left')
231-
d = a.join(b, on=['Cat1', 'Int1'])
232-
c = c.drop(['Cat', 'Int'], axis=1)
233-
assert_frame_equal(c, d)
230+
expected = merge(a, b.reset_index(), left_on=['Cat1', 'Int1'],
231+
right_on=['Cat', 'Int'], how='left')
232+
result = a.join(b, on=['Cat1', 'Int1'])
233+
expected = expected.drop(['Cat', 'Int'], axis=1)
234+
assert_frame_equal(expected, result)

0 commit comments

Comments
 (0)