Skip to content

Commit

Permalink
bugfix getitem with integer
Browse files Browse the repository at this point in the history
  • Loading branch information
BalzaniEdoardo committed Dec 20, 2024
1 parent 4aca053 commit 4436e2f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pynapple/core/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ def __getitem__(self, key, *args, **kwargs):
if (
(len(index) == 1)
and (output.ndim == 1)
and ((len(output) > 1) or isinstance(key[1], (list, np.ndarray)))
and ((len(output) > 1) or isinstance(key, int) or isinstance(key[1], (list, np.ndarray)))
):
# reshape output of single index to preserve column axis if there are more than one columns being indexed
# or if column key is a list or array
Expand Down
1 change: 1 addition & 0 deletions tests/test_time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ def test_interpolate_with_ep(self, tsd):
@pytest.mark.parametrize(
"tsdframe",
[
nap.TsdFrame(t=np.arange(100), d=np.random.rand(100, 1), time_units="s"),
nap.TsdFrame(t=np.arange(100), d=np.random.rand(100, 3), time_units="s"),
nap.TsdFrame(
t=np.arange(100),
Expand Down

0 comments on commit 4436e2f

Please sign in to comment.