issues: 1466586967
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1466586967 | I_kwDOAMm_X85XaldX | 7328 | Zarr store array dtype changes for empty object string | 85085 | closed | 0 | 2 | 2022-11-28T15:05:14Z | 2023-06-16T03:56:16Z | 2023-06-16T03:56:16Z | CONTRIBUTOR | What happened?Saving a dataset with an empty object (string) variable to zarr changes the dtype to float64. What did you expect to happen?The dtype should remain as Minimal Complete Verifiable Example```Python import numpy as np import xarray as xr ds = xr.Dataset({"a": np.array([], dtype="O")}) ds["a"].dtype prints: dtype('O')ds.to_zarr("a.zarr") ds = xr.open_dataset("a.zarr") ds["a"].dtype prints: dtype('float64')``` MVCE confirmation
Relevant log outputNo response Anything else we need to know?No response Environment
INSTALLED VERSIONS
------------------
commit: None
python: 3.8.13 (default, Mar 28 2022, 06:16:26)
[Clang 12.0.0 ]
python-bits: 64
OS: Darwin
OS-release: 21.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: ('en_GB', 'UTF-8')
libhdf5: None
libnetcdf: None
xarray: 2022.11.0
pandas: 1.5.0
numpy: 1.23.4
scipy: 1.9.2
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.13.3
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2022.10.0
distributed: 2022.10.0
matplotlib: 3.6.1
cartopy: None
seaborn: 0.12.0
numbagg: None
fsspec: 2022.8.2
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 63.4.1
pip: 22.2.2
conda: None
pytest: 7.1.3
IPython: 8.5.0
sphinx: 4.2.0
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/7328/reactions", "total_count": 2, "+1": 2, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |