diff options
| author | Bas van Beek <b.f.van.beek@vu.nl> | 2021-10-09 13:05:43 +0200 |
|---|---|---|
| committer | Bas van Beek <b.f.van.beek@vu.nl> | 2021-10-09 13:05:43 +0200 |
| commit | 3e2e04fae6787732c8de7eff0d525dfe8bf11b10 (patch) | |
| tree | 441e96582cc2ccca8c4986d929e3e872ecca11b1 | |
| parent | f53077617d5d92ab76cc9a01bb55913b1f4fcbe7 (diff) | |
| download | numpy-3e2e04fae6787732c8de7eff0d525dfe8bf11b10.tar.gz | |
DOC: Document the dtype comparison operations
| -rw-r--r-- | doc/source/reference/arrays.dtypes.rst | 10 | ||||
| -rw-r--r-- | numpy/core/_add_newdocs.py | 62 |
2 files changed, 72 insertions, 0 deletions
diff --git a/doc/source/reference/arrays.dtypes.rst b/doc/source/reference/arrays.dtypes.rst index 34b0d7085..8606bc8f1 100644 --- a/doc/source/reference/arrays.dtypes.rst +++ b/doc/source/reference/arrays.dtypes.rst @@ -569,3 +569,13 @@ Utility method for typing: :toctree: generated/ dtype.__class_getitem__ + +Comparison operations: + +.. autosummary:: + :toctree: generated/ + + dtype.__ge__ + dtype.__gt__ + dtype.__le__ + dtype.__lt__ diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py index 37f21211f..7467be80f 100644 --- a/numpy/core/_add_newdocs.py +++ b/numpy/core/_add_newdocs.py @@ -6113,6 +6113,68 @@ add_newdoc('numpy.core.multiarray', 'dtype', ('__class_getitem__', """)) +add_newdoc('numpy.core.multiarray', 'dtype', ('__ge__', + """ + __ge__(value, /) + + Return ``self >= value``. + + Equivalent to ``np.can_cast(value, self, casting="safe")``. + + See Also + -------- + can_cast : Returns True if cast between data types can occur according to + the casting rule. + + """)) + +add_newdoc('numpy.core.multiarray', 'dtype', ('__le__', + """ + __le__(value, /) + + Return ``self <= value``. + + Equivalent to ``np.can_cast(self, value, casting="safe")``. + + See Also + -------- + can_cast : Returns True if cast between data types can occur according to + the casting rule. + + """)) + +add_newdoc('numpy.core.multiarray', 'dtype', ('__gt__', + """ + __ge__(value, /) + + Return ``self > value``. + + Equivalent to + ``self != value and np.can_cast(value, self, casting="safe")``. + + See Also + -------- + can_cast : Returns True if cast between data types can occur according to + the casting rule. + + """)) + +add_newdoc('numpy.core.multiarray', 'dtype', ('__lt__', + """ + __lt__(value, /) + + Return ``self < value``. + + Equivalent to + ``self != value and np.can_cast(self, value, casting="safe")``. + + See Also + -------- + can_cast : Returns True if cast between data types can occur according to + the casting rule. + + """)) + ############################################################################## # # Datetime-related Methods |
