Sublime Forum

Numpy installation

#1

Hi.
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 prompt.it 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])
print(arr)

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!

0 Likes

#2

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

#3

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