Skip to content

"IndexError: List index out of range" when copying value from filtered (single-value) array #270

Closed
@yvdabb

Description

@yvdabb

Example:

import larray as la

age = la.Axis(['young', 'old'], 'age')
time = la.Axis('time=2021..2023')
gender = la.Axis(['female', 'male'], 'gender')
data = [
    [[1, 2, 3],
     [4, 5, 6]],
    [[7, 8, 9],
     [10, 11, 12]]
]

population = la.Array(data, axes=[age, gender, time])

la.view()

When filtering this array down to a "single-value array," the copy functionality stops working.

image

The following error is produced:

IndexError: list index out of range
Traceback (most recent call last):
  File "C:\soft\Miniconda3\lib\site-packages\larray_editor\arraywidget.py", line 1069, in copy
    raw_data, axes_names, vlabels, hlabels = self._selection_data()
  File "C:\soft\Miniconda3\lib\site-packages\larray_editor\arraywidget.py", line 1061, in _selection_data
    hlabels = [label[0] for label in self.model_hlabels.get_values(top=col_min, bottom=col_max)]
  File "C:\soft\Miniconda3\lib\site-packages\larray_editor\arraywidget.py", line 1061, in <listcomp>
    hlabels = [label[0] for label in self.model_hlabels.get_values(top=col_min, bottom=col_max)]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions