python array


i have this code that i am trying to understand..

 np.subtract.outer(obs[:,0], interp[:,0])

even when i run the program..i dont understand.....
Who is Participating?
gelonidaConnect With a Mentor Commented:
OK. This code is heavily using numpy, with which I have unfortunately very little experience.

You see, that numpy is imported as np,
which means, that all functions like for example
np.vstack() are numpy functions.

so the line
obs = np.vstack((x0, y0)).T

creates some numpy object, which is not a standard array, but an object of the type
numpy.ndarray, which is an n-dimensional array and allows manipulations not supported by normal python arrays.

Please look at Numpy's documentation:

The third example explains the slicing syntax

y = x[:,1]
I am guessing, that obs and interp are no standard python data types, but some
special class of a special library.

In order to verify my assumption:
could you add following line before this line in question and tell me what's printed out

print('type of obs = %r' % type(obs))
zizi21Author Commented:
I am trying to understand teh second code from here

It is self created array ...
zizi21Author Commented:
Thanks a lot
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.