8000 BUG: Load data from a CategoricalIndex for dtype comparison, closes #… by thequackdaddy · Pull Request #16738 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: Load data from a CategoricalIndex for dtype comparison, closes #… #16738

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

Merged
merged 4 commits into from
Jun 30, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixed some documentation/formatting issues, clarified the purpose of …
…the test case.
  • Loading branch information
thequackdaddy committed Jun 29, 2017
commit 081c3ced906411c78e6b290efd3e9892de1ef76b
7 changes: 4 additions & 3 deletions doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,11 @@ run this slightly modified command::

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

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

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

Backwards Compatibility
~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.20.3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Indexing
^^^^^^^^

- 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`)
- Fixed a bug that prevented joining on a categorical MultiIndex (:issue:`16627`).

I/O
^^^
Expand Down Expand Up @@ -79,6 +78,7 @@ Sparse
Reshaping
^^^^^^^^^

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


Numeric
Expand Down
21 changes: 11 additions & 10 deletions pandas/tests/test_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,13 @@ def test_merge_join_categorical_multiindex():
'Factor': [1.1, 1.2, 1.3, 1.4, 1.5, 1.6]}
b = DataFrame(b).set_index(['Cat', 'Int'])['Factor']

c = merge(a, b.reset_index(), left_on=['Cat1', 'Int1'],
right_on=['Cat', 'Int'], how='left')
d = a.join(b, on=['Cat1', 'Int1'])
c = c.drop(['Cat', 'Int'], axis=1)
assert_frame_equal(c, d)
expected = merge(a, b.reset_index(), left_on=['Cat1', 'Int1'],
right_on=['Cat', 'Int'], how='left')
result = a.join(b, on=['Cat1', 'Int1'])
expected = expected.drop(['Cat', 'Int'], axis=1)
assert_frame_equal(expected, result)

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

c = merge(a, b.reset_index(), left_on=['Cat1', 'Int1'],
right_on=['Cat', 'Int'], how='left')
d = a.join(b, on=['Cat1', 'Int1'])
c = c.drop(['Cat', 'Int'], axis=1)
assert_frame_equal(c, d)
expected = merge(a, b.reset_index(), left_on=['Cat1', 'Int1'],
right_on=['Cat', 'Int'], how='left')
result = a.join(b, on=['Cat1', 'Int1'])
expected = expected.drop(['Cat', 'Int'], axis=1)
assert_frame_equal(expected, result)
0