Question: PYTHON DATA SCIENCE PROGRAMMING # QUESTION: Given an arbitrary array X, complete the function filter to # a) select rows that have no negative values
PYTHON DATA SCIENCE PROGRAMMING
# QUESTION: Given an arbitrary array X, complete the function filter to
# a) select rows that have no negative values
# b) select columns whose sum is bigger than 15
import pandas as pd
import numpy as np
def filter(X):
#
# COMPLETE HERE
#
#X = X[:,X.min(axis=0)>=0]
return X
#the following lines create a random array to test your function with that.
np.random.seed(10)
A = np.random.randint(10,size=(4,7))
A[1,3] = -1.0
print(str(A)+' ')
print(filter(A))
# QUESTION: Given an arbitrary array X, complete the function filter to # a) select rows that have no negative values # b) select columns whose sum is bigger than 15 import pandas as pd import numpy as np def filter (X): # # COMPLETE HERE # #x = X[:,X.min(axis=0)>=0 ] return x #the following lines create a random array to test your function with that. np.random.seed (10) A = np.random.randint(10,size=(4,7)) A[1,3] = -1.0 print(str(A)+' ') print(filter(A))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
