empty_like for object array raises warning
See original GitHub issue import zarr
z = zarr.empty(shape=(2,), dtype="array:u1")
z[0] = [0, 1, 2]
z[1] = [0, 0]
print(z, z[:])
y = zarr.empty_like(z) # Emits warning
y[0] = [0, 1, 2]
y[1] = [0, 0]
print(y, y[:])
Gives:
<zarr.core.Array (2,) object> [array([0, 1, 2], dtype=uint8) array([0, 0], dtype=uint8)]
/home/jk/.local/lib/python3.5/site-packages/zarr/storage.py:372: FutureWarning: missing object_codec for object array; this will raise a ValueError in version 3.0
'ValueError in version 3.0', FutureWarning)
<zarr.core.Array (2,) object> [array([0, 1, 2], dtype=uint8) array([0, 0], dtype=uint8)]
Problem description
It seems that empty_like
is somehow not copying the codec? However, the array seems to behave perfectly well as a object array, so I’m not sure what’s happening.
Version and installation information
Please provide the following:
- Value of
zarr.__version__
: 2.2.0 - Value of
numcodecs.__version__
: 0.5.3 - Version of Python interpreter: 3.5.2
- Operating system (Linux/Windows/Mac): Linux
- How Zarr was installed (e.g., “using pip into virtual environment”, or “using conda”):pip
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
"Controlled" creation of object arrays #15047 - numpy ... - GitHub
Auto-creation of object arrays was recently deprecated in numpy. ... I'm still not clear why the warnings were not raised in the release ......
Read more >Why does console.log display array different than alert?
When constructing an object and printing that object to the console, console.log() will output the object's own properties and their values.
Read more >Function object, NFE - The Modern JavaScript Tutorial
In that case, the name property is empty, like here: // function created inside array let arr = [function() {}]; alert( arr[0].name ) ......
Read more >Guide to NumPy
trying to set this attribute raises an Error. flat. Return an iterator object (numpy.flatiter) that acts like a 1-d version of the array....
Read more >NumPyBook - Linguagem de Programação. - 19 - Passei Direto
N −1 slice objects) it does exactly what you would expect (concatenation of ... Use of this routine increases the chance that array...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yep thanks. Was ignoring it anyway 😃
Thanks Jerome, this looks like just an API inconsistency, I didn’t properly consider the
..._like
creation functions when writing the logic for how theobject_codec
keyword argument is handled. We should fix this so that no warning is emitted. For now you can ignore the warning, the array should be fine.