Sublime Forum

Numpy installation


I commenced to work with python(sumlime) and growing up gradually, when I learned array, I faced to numpy topic and tried to install numpy with command is result of my installation:
pip show numpy
Name: numpy
Version: 1.19.4
Summary: NumPy is the fundamental package for array computing with Python.
Required-by: scipy, matplotlib

it shows that installation performed successfully.
I tried to run simple code like it

arr=array(‘i’, [1,2,32,5,4], [3,5,6,9])

it worth to be mentioned numpy has already imported

I faced with this ERROR
TypeError: array() takes at most 2 arguments (3 given)

what’s wrong with me!



Haven’t used numpy much, but my guess is you want to do array(‘i’, [[1,2,32,5,4], [3,5,6,9]]). Note the extra set of [].

1 Like


import numpy as np
first when you use Numpy module, you should add ‘np.’ like: a=np.array([1,2,3])
second, Numpy module can only solved with numerical data(like 1,2,3) and it can not solved non-numerical data(like string data ‘i’)
last,the dimension of matrix you defined is wrong,you should defined it like a=np.array([[1,2,3],[4,5,6]])

1 Like