3.14 Comparing Arrays and Advanced indexing Arrays: -

 Comparing arrays: -

  • A relational operator returns either TRUE or FALSE.
  • Relational operator like >, >=, <, <=, ==, != can be used for comparing two arrays of same size.

            Example: -


                Output: -


Advanced indexing: -

  • Advanced indexing returns a copy of data.
  • It is of two types:

                1. Integer indexing.

                2. Boolean indexing.

 

1) Integer indexing: -

  • Integer indexing in NumPy means accessing elements of an array using integer values that represent their positions (indices) in the array.
  • It allows you to select specific elements from an array based on their index numbers, rather than slicing a continuous range.

            Example: -


            Output: -


2) Boolean indexing: -

  • Boolean indexing in NumPy means selecting elements from an array using True or False values.
  • It allows you to filter elements that satisfy a condition.

            Example: -

            Output: -




Popular posts from this blog

operators in c programming

Variables in c

2.4 Arrays in c programming