DEV Community

Punitha
Punitha

Posted on

Array Operations

What is np.linspace()?

  • np.linspace() creates a specified number of equally spaced values between a starting value and an ending value.

Output:

What is Boolean Masking?

  • Boolean masking is used to select elements based on a condition.

Step 1: Create an Array

Step 2: Create a Condition

Output:

Element-wise Operations

  • NumPy allows us to perform operations on every element of an array.

Step 1:

Step 2: Multiplication and Division

Output:

Flatten an Array

What is flatten()?

  • flatten() converts a multi-dimensional array into a one-dimensional array.

Step 1:

Step 2:

Output:

Top comments (0)