We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 45146ca commit a9531caCopy full SHA for a9531ca
src/zarr/core/array.py
@@ -1245,6 +1245,8 @@ async def _get_selection(
1245
out_buffer,
1246
drop_axes=indexer.drop_axes,
1247
)
1248
+ if indexer.shape == ():
1249
+ return out_buffer.as_numpy_array().item()
1250
return out_buffer.as_ndarray_like()
1251
1252
async def getitem(
tests/test_array.py
@@ -1262,3 +1262,5 @@ async def test_scalar_array() -> None:
1262
assert arr[...] == 1.5
1263
assert arr[()] == 1.5
1264
assert arr.shape == ()
1265
+ assert isinstance(arr[()], float)
1266
+ assert arr.ndim == 0
0 commit comments