8000 CLN: handle EAs and fast path (no bounds checking) in safe_sort by jorisvandenbossche · Pull Request #25696 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

CLN: handle EAs and fast path (no bounds checking) in safe_sort #25696

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 17 commits into from
May 7, 2019
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
7356997
BUG: fix usage of na_sentinel with sort=True in factorize()
jorisvandenbossche Mar 7, 2019
e1ab3a4
fix dtype
jorisvandenbossche Mar 11, 2019
a9c880e
Merge remote-tracking branch 'upstream/master' into factorize-na-sent…
jorisvandenbossche Mar 11, 2019
db30797
Merge remote-tracking branch 'upstream/master' into factorize-na-sent…
jorisvandenbossche Mar 12, 2019
ba944eb
Attempt to include it in safe_sort
jorisvandenbossche Mar 12, 2019
c6203cb
Merge remote-tracking branch 'upstream/master' into factorize-na-sent…
jorisvandenbossche Mar 12, 2019
d70b447
Merge remote-tracking branch 'upstream/master' into factorize-na-sent…
jorisvandenbossche Apr 5, 2019
fdf330a
feedback Jeff
jorisvandenbossche Apr 5, 2019
b08ea6d
add tests for safe_sort
jorisvandenbossche Apr 5, 2019
9de26fc
additional test for other na_sentinel in case of out of bound indices
jorisvandenbossche Apr 5, 2019
bcb8c7e
additional test for EA with custom na_sentinel
jorisvandenbossche Apr 5, 2019
13f6706
update factorize test for EAs with custom na_sentinel (which now work…
jorisvandenbossche Apr 5, 2019
8db84e7
Merge remote-tracking branch 'upstream/master' into factorize-na-sent…
jorisvandenbossche Apr 5, 2019
d0cef9e
Merge remote-tracking branch 'upstream/master' into factorize-na-sent…
jorisvandenbossche Apr 11, 2019
5157e89
Merge remote-tracking branch 'upstream/master' into factorize-na-sent…
jorisvandenbossche May 6, 2019
e350641
linting
jorisvandenbossche May 6, 2019
151aa6a
more linting
jorisvandenbossche May 6, 2019
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
additional test for other na_sentinel in case of out of bound indices
  • Loading branch information
jorisvandenbossche committed Apr 5, 2019
commit 9de26fc83c39b4fc8863a9a827eedf7b1a117ea0
10 changes: 7 additions & 3 deletions pandas/tests/test_sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,18 @@ def test_labels(self, verify):
tm.assert_numpy_array_equal(result, expected)
tm.assert_numpy_array_equal(result_labels, expected_labels)

def test_labels_out_of_bound(self):
@pytest.mark.parametrize('na_sentinel', [-1, 99])
def test_labels_out_of_bound(self, na_sentinel):
values = [3, 1, 2, 0, 4]
expected = np.array([0, 1, 2, 3, 4])

# out of bound indices
labels = [0, 101, 102, 2, 3, 0, 99, 4]
result, result_labels = safe_sort(values, labels)
expected_labels = np.array([3, -1, -1, 2, 0, 3, -1, 4], dtype=np.intp)
result, result_labels = safe_sort(
values, labels, na_sentinel=na_sentinel)
expected_labels = np.array(
[3, na_sentinel, na_sentinel, 2, 0, 3, na_sentinel, 4],
dtype=np.intp)
tm.assert_numpy_array_equal(result, expected)
tm.assert_numpy_array_equal(result_labels, expected_labels)

Expand Down
0