- NumPy provides different functions to combine arrays.
- stack()
- hstack()
- vstack()
What is stack()?
- stack() combines arrays along a new axis
Step 1:
Step 2:
Output:
What is hstack()?
- hstack() combines arrays horizontally.
Step 1:
Step 2:
Output:
What is vstack()?
- vstack() combines arrays vertically.
Step 1:
Step 2:
Output:
What is clip()?
- np.clip() limits array values to a specified minimum and maximum range.
Step 1:
Output:
Step 2:
Output:
What is np.where()?
- np.where() selects one value when a condition is true and another value when it is false.
Step 1:
Output:
Step 2:
Output:















Top comments (0)