[Tutor] Numpy documentation
Alan Gauld
alan.gauld at yahoo.co.uk
Thu Oct 4 17:18:57 EDT 2018
On 04/10/18 20:02, 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.
Nope. Its the other way round. The first axis is
the "column" of two rows. Hence length 2.
The second axis is the row with 3 elements in each.
If you look at it as a table you can access the
elements using x,y coordinates. The x coordinate
(being first) denotes which row is indicated and
the y axis being second denotes the element within
the row.
> ...But why does the first axis have a length of 2?
Because there are two rows.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list