issues: 1579956621
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1579956621 | I_kwDOAMm_X85eLDmN | 7519 | Selecting variables from Dataset with view on dict keys is of type DataArray | 25172489 | closed | 0 | 7 | 2023-02-10T16:02:19Z | 2024-04-28T21:01:28Z | 2024-04-28T21:01:27Z | NONE | What happened?When selecting variables from a Dataset using a view on dict keys, the type returned is a DataArray, whereas the same using a list is a Dataset. What did you expect to happen?The type returned should be a Dataset. Minimal Complete Verifiable Example```Python import xarray as xr d = {"a": ("dim", range(1, 4)), "b": ("dim", range(2, 5))} data = xr.Dataset(d) select_dict = data[d.keys()] select_list = data[list(d)] reveal_type(select_dict) reveal_type(select_list) ``` MVCE confirmation
Relevant log output
Anything else we need to know?No response Environment
INSTALLED VERSIONS
------------------
commit: None
python: 3.9.10 (main, Mar 15 2022, 15:56:56)
[GCC 7.5.0]
python-bits: 64
OS: Linux
OS-release: 3.10.0-1160.49.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.2
libnetcdf: 4.9.0
xarray: 2022.12.0
pandas: 1.5.2
numpy: 1.23.5
scipy: 1.10.0
netCDF4: 1.6.2
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.6.2
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: 3.6.3
cartopy: None
seaborn: None
numbagg: None
fsspec: None
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 58.1.0
pip: 23.0
conda: None
pytest: 7.2.1
mypy: 0.991
IPython: 8.8.0
sphinx: None
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/7519/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |