10000 REF/BUG/API: factorizing categorical data by TomAugspurger · Pull Request #19938 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

REF/BUG/API: factorizing categorical data #19938

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 14 commits into from
Mar 15, 2018
Merged
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
Next Next commit
Explicit dtype for expected
  • Loading branch information
TomAugspurger committed Feb 28, 2018
commit 9ef5be218ca60aea53e24b2c2ae322413e9b401e
6 changes: 3 additions & 3 deletions pandas/tests/categorical/test_algos.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_factorize(categories, ordered):
categories=categories,
ordered=ordered)
labels, uniques = pd.factorize(cat)
expected_labels = np.array([0, 0, 1, 2, -1])
expected_labels = np.array([0, 0, 1, 2, -1], dtype='int64')
expected_uniques = pd.Categorical(['b', 'a', 'c'],
categories=categories,
ordered=ordered)
Expand All @@ -27,7 +27,7 @@ def test_factorize(categories, ordered):
def test_factorized_sort():
cat = pd.Categorical(['b', 'b', None, 'a'])
labels, uniques = pd.factorize(cat, sort=True)
expected_labels = np.array([1, 1, -1, 0])
expected_labels = np.array([1, 1, -1, 0], dtype='int64')
expected_uniques = pd.Categorical(['a', 'b'])

tm.assert_numpy_array_equal(labels, expected_labels)
Expand All @@ -40,7 +40,7 @@ def test_factorized_sort_ordered():
ordered=True)

labels, uniques = pd.factorize(cat, sort=True)
expected_labels = np.array([0, 0, -1, 1])
expected_labels = np.array([0, 0, -1, 1], dtype='int64')
expected_uniques = pd.Categorical(['b', 'a'],
categories=['c', 'b', 'a'],
ordered=True)
Expand Down
0