[Numpy-discussion] Broadcasting rules (Ticket 76).

Sasha ndarray at mac.com
Wed Apr 26 15:58:04 CDT 2006


On 4/26/06, Bill Baxter <wbaxter at gmail.com> wrote:
> Is that a representative example?   It seems highly unlikely that in real
> life every one of the schools would have exactly 20 classes, and each of
> those exactly 30 students.

You should not take my toy example too seriousely.  However, with
support for missing values, 3-d arrays may provide an efficient
representation for a more realistic scenario when you only know upper
bounds for the number of students/classes.  Smaller schools will have
missing values in their arrays.

>  I don't know anything about R or the way things
> are typically done with statistical languages -- maybe this is the norm
> there -- but from a pure CompSci data structures perspective, a 3D array
> seems ill-suited for this type of hierarchical data.  Something more
> flexible, along the lines of a Python list of list of list, seems more
> apropriate.
>
You are right.  I am sorely missing ragged array support in numpy like
the one available in K.  Numpy supports nested arrays, but does not
optimize the most common case when nested arrays are of the same type.


> --bill
>
>
> On 4/27/06, Sasha <ndarray at mac.com> wrote:
>
> > Suppose we study school statistics in
> > different cities.  Let city A have 10 schools with 20 classes and 30
> > students in each.  It is natural to organize the data collected about
> > the students in a 10x20x30 array.
> >
>




More information about the Numpy-discussion mailing list