Question: Python: Q3. Complete the function according to its docstring. def only_positive(arr): '''Return a numpy array containing only the rows from arr where all the values

Python:

Q3. Complete the function according to its docstring.

def only_positive(arr):

'''Return a numpy array containing only the rows from arr where all

the values in that row are positive.

FOR FULL POINTS USE NUMPY METHODS AND NO LOOPS OR LIST COMPREHENSIONS.

Parameters

----------

arr: Numpy Array (2-dimensional)

Returns

-------

NumPy Array (2-dimensional)

Example

=======

arr = np.array([

[1, -1, 2],

[3, 4, 2],

[-8, 4, -4]

])

only_positive(arr) returns:

np.array([[3, 4, 2]])

'''

pass

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!