larray-project / larray

N-dimensional labelled arrays in Python
https://larray.readthedocs.io/
GNU General Public License v3.0
8 stars 6 forks source link

Array.values(axes=0) is buggy #1093

Open gdementen opened 5 months ago

gdementen commented 5 months ago

Array.items(axes=0) is broken too but that's just a consequence of this bug

>>> arr = la.ndtest((2, 3))
>>> arr
a\b  b0  b1  b2
 a0   0   1   2
 a1   3   4   5
>>> r = arr.values(axes=0)
>>> assert r[0].equals(arr['a0'])
AssertionError: 

Problem is at line 3437:

        elif not axes:

should be:

        elif len(axes) == 0:

and should happen after axes = (axes,)

Current workaround:

r = arr.values(axes=[0])