8000 Inconsistent `()` indexing/size behavior from v2->v3 · Issue #2713 · zarr-developers/zarr-python · GitHub
[go: up one dir, main page]

Skip to content
Inconsistent () indexing/size behavior from v2->v3 #2713
Closed
@ilan-gold

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

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

      0