Oct-31-2017, 05:34 PM
Dear Python Experts,
I have an array with values of 0 and something above 1.
array([0, 0, 0, ..., 1.64, 0, 1.99])
I need to convert it to an array that shows a 0 for every 0
and a 1 for every value above 1.
I have no idea how to go through the array and convert.
Would appreciate any help.
I have an array with values of 0 and something above 1.
def af(): from sklearn.metrics import confusion_matrix from sklearn.svm import SVC svm = SVC(C=1e9, gamma=1e-07).fit(X_train,y_train) svm_predicted_mc = svm.predict(X_test) return svm_predicted_mc af()Output:
array([0, 0, 0, ..., 1.64, 0, 1.99])
I need to convert it to an array that shows a 0 for every 0
and a 1 for every value above 1.
I have no idea how to go through the array and convert.
Would appreciate any help.