Skip to content

Commit

Permalink
compatibility with numpy>=2.0 (#257)
Browse files Browse the repository at this point in the history
* attempt to fix the upstream-dev CI

* replace `np.unicode_` with `np.str_`

* remove `PROMOTE_TO_OBJECT` entirely
  • Loading branch information
keewis authored Aug 31, 2023
1 parent 3fb613c commit bf49017
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/upstream-dev-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
upstream-dev:
name: upstream-dev
runs-on: ubuntu-latest
if: ${{ contains( github.event.pull_request.labels.*.name, 'test-upstream') && github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
if: ${{ (contains(github.event.pull_request.labels.*.name, 'test-upstream') && github.event_name == 'pull_request') || github.event_name == 'workflow_dispatch' }}
defaults:
run:
shell: bash -l {0}
Expand Down
11 changes: 0 additions & 11 deletions flox/xrdtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ def __eq__(self, other):
NINF = AlwaysLessThan()


# Pairs of types that, if both found, should be promoted to object dtype
# instead of following NumPy's own type-promotion rules. These type promotion
# rules match pandas instead. For reference, see the NumPy type hierarchy:
# https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.scalars.html
PROMOTE_TO_OBJECT = [
{np.number, np.character}, # numpy promotes to character
{np.bool_, np.character}, # numpy promotes to character
{np.bytes_, np.unicode_}, # numpy promotes to unicode
]


def maybe_promote(dtype):
"""Simpler equivalent of pandas.core.common._maybe_promote
Expand Down

0 comments on commit bf49017

Please sign in to comment.