I have an array (numpy) but an error is generated when I run the program itself
import numpy as np
from sklearn import preprocessing
Input_data = np.array([2.1, -1.9, 5.5],[-1.5, 2.4, 3.5],[0.5, -7.9, 5.6],[5.9, 2.3, -5.8])
data_binarized = preprocessing.Binarizer(threshold=0.5).transform(input_data
)
print("\nBinarized data:\n", data_binarized)
error:
TypeError: array() takes from 1 to 2 positional arguments but 4 were given
I've tried removing the square brackets and rearranging them, but to no avail.
You need to declare it like this:
np.array([[2.1, -1.9, 5.5],[-1.5, 2.4, 3.5],[0.5, -7.9, 5.6],[5.9, 2.3, -5.8]])