Jump to content

Python: Array Problem

Featured Replies

Hi,

I am trying to compile the following program:

import numpy as np
import sklearn.preprocessing
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)

 

I am getting the following error:

Traceback (most recent call last):
  File "/home/zulfi/PycharmProjects/AI/AI1.py", line 8, in <module>
    [5.9, 2.3, -5.8])
TypeError: array() takes from 1 to 2 positional arguments but 4 were given

Process finished with exit code 1


Some body please  guide me.

 

Zulfi.

  • Author

Hi,

Thanks, it worked. God bless you.

 

Zulfi.

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.