[Tutor] Numpy documentation

Steven D'Aprano steve at pearwood.info
Thu Oct 4 18:25:29 EDT 2018


Hi Roger,

My comments below, below yours.

On Thu, Oct 04, 2018 at 12:02:01PM -0700, Roger Lea Scherer wrote:

[...]
>  In the example pictured below, the array has 2 axes. The first axis has a
> length of 2, the second axis has a length of 3.
> [[ 1., 0., 0.],
>  [ 0., 1., 2.]]
> 
> (I think) I understand the 2 axes. [1,0,0] (I'm lazy and don't want to type
> the periods) is one axis and [0,1,2] is the second axis.

You can copy and paste text to avoid extra typing.

You seem to be are thinking along the lines of axles in a car, where the 
two axles run parallel:

Axle one: ---------
Axle two: ---------


You should think of axes of a graph, which run perpendicular to each 
other, like the lines of a plus sign + or cross.

So the array:

[[ 1., 0., 0.],
 [ 0., 1., 2.]]

is two dimensional, with 2 rows and 3 columns. In mathematics, we 
would call it a 2x3 matrix; in programming, it would be a 2x3 array.

Axis one (rows): length 2
Axis two (columns): length 3


Regards,



-- 
Steve


More information about the Tutor mailing list