Skip to content

Inconsistent () indexing/size behavior from v2->v3 #2713

Description

@ilan-gold

Zarr version

v3.0.0

Numcodecs version

0.14.1

Python Version

3.12

Operating System

Mac

Installation

uv

Description

Previously something like z[()] where z is a () shape array would return a scalar and now returns a one-elem array e.g., np.array(1) instead of np.float64(1.0)

Steps to reproduce

v3:

import numpy as np
import zarr

z = zarr.open_group('foo.zarr')
z.create_array("bar", dtype=float, shape=())
z["bar"][...] = np.array(1) # why doesn't [:] work?
z["bar"][()] # array

v2:

import numpy as np
import zarr

z = zarr.open_group('foo.zarr')
z.create_dataset("bar", dtype=float, shape=(), data=np.array(1))
z["bar"][()] # np.float

Additional output

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions