8000 API: NaT (arg)min/max behavior by zjpoh · Pull Request #14717 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

API: NaT (arg)min/max behavior #14717

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
Oct 16, 2019
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
Fix spaces and make argmin/argmax consistent
  • Loading branch information
zjpoh committed Oct 15, 2019
commit c29f6ad8878539abb72b24c28e57b6b9fcde4083
27 changes: 14 additions & 13 deletions numpy/core/src/multiarray/arraytypes.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -3105,7 +3105,7 @@ static int
}
#endif
#if @isdatetime@
if (mp == NPY_DATETIME_NAT) {
if (mp == NPY_DATETIME_NAT) {
/* NaT encountered, it's maximal */
return 0;
}
Expand All @@ -3130,11 +3130,11 @@ static int
}
#else
#if @isdatetime@
if (*ip == NPY_DATETIME_NAT) {
/* NaT encountered, it's maximal */
*max_ind = i;
break;
}
if (*ip == NPY_DATETIME_NAT) {
/* NaT encountered, it's maximal */
*max_ind = i;
break;
}
#endif
if (!@le@(*ip, mp)) { /* negated, for correct nan handling */
mp = *ip;
Expand Down Expand Up @@ -3211,7 +3211,7 @@ static int
}
#endif
#if @isdatetime@
if (mp == NPY_DATETIME_NAT) {
if (mp == NPY_DATETIME_NAT) {
/* NaT encountered, it's minimal */
return 0;
}
Expand All @@ -3235,6 +3235,13 @@ static int
}
}
#else
#if @isdatetime@
if (*ip == NPY_DATETIME_NAT) {
/* NaT encountered, it's minimal */
*min_ind = i;
break;
}
#endif
if (!@le@(mp, *ip)) { /* negated, for correct nan handling */
mp = *ip;
*min_ind = i;
Expand All @@ -3244,12 +3251,6 @@ static int
break;
}
#endif
#if @isdatetime@
if (mp == NPY_DATETIME_NAT) {
/* NaT encountered, it's minimal */
break;
}
#endif
}
#endif
}
Expand Down
0