NumPy - Logical operations

Numpy is a Python package for doing scientific computing in Python using multi dimensional arrays of large sizes. Along with several categories of functions, NumPy offers a set of logical functions that perform truth value testing, relational operations, AND, OR, XOR, NOT operations, testing for infinities, Not a Number and other operations.

The size of the data, smaller or larger-the results of scientific experiments and from mathematical operations involve extremities like infinity and not a number. For certain mathematical operations, the result is undefined and termed as “Not a Number”. “Not a Number” is denoted by the name nan in numpy. NumPy has operations for testing finite numbers, positive infinity, negative infinity and not a number.

NumPy provides functions for relational operations including greater than, less than, greater than or equal to, less than or equal to, equal to and not equal to.

Many of these logical operations work on both numpy array-likes and scalars. Some of these NumPy logical functions take a NumPy array-like or scalar as input and others take two array-likes or scalars as input.


Copyright 2024 © pythontic.com