home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 656089264

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
656089264 MDU6SXNzdWU2NTYwODkyNjQ= 4220 combine_first of Datasets changes dtype of variable present only in one Dataset 601177 open 0     2 2020-07-13T19:36:41Z 2023-05-12T08:55:10Z   NONE      

What happened: I was combining two Datasets using combine_first and to my surprise the dtype of one of the DataArrays in the merged Dataset was changed (from bool to float64).

What you expected to happen: No change in dtype.

Minimal Complete Verifiable Example:

```python

import xarray as xr  ds = xr.Dataset(coords={'abc': list('abc')})  ds['x'] = ('abc', [1., 2., 3.]) ds['y'] = ('abc', [-1., -2., -3.])  ds['t'] = ('abc', [True, False, True]) ds <xarray.Dataset> Dimensions: (abc: 3) Coordinates: * abc (abc) <U1 'a' 'b' 'c' Data variables: x (abc) float64 1.0 2.0 3.0 y (abc) float64 -1.0 -2.0 -3.0 t (abc) bool True False True  xy4b = ds[['x', 'y']].sel(abc=~ds.t) * 10 xy4b.combine_first(ds) Out[14]: <xarray.Dataset> Dimensions: (abc: 3) Coordinates: * abc (abc) object 'a' 'b' 'c' Data variables: x (abc) float64 1.0 20.0 3.0 y (abc) float64 -1.0 -20.0 -3.0 t (abc) float64 1.0 0.0 1.0 ```

Anything else we need to know?: No.

Environment:

Output of <tt>xr.show_versions()</tt> commit: None python: 3.7.8 (default, Jul 5 2020, 21:51:42) [GCC 9.3.0] python-bits: 64 OS: Linux OS-release: 5.4.48-gentoo machine: x86_64 processor: Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz byteorder: little LC_ALL: None LANG: nl_BE.UTF-8 LOCALE: nl_BE.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.6.1 xarray: 0.12.1 pandas: 1.0.4 numpy: 1.18.5 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: None cftime: 1.1.3 nc_time_axis: None PseudonetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.2 dask: 1.2.0 distributed: None matplotlib: 3.2.1 cartopy: None seaborn: None setuptools: 46.4.0 pip: 20.0.2 conda: None pytest: None IPython: 7.16.1 sphinx: 3.0.4
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4220/reactions",
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 0.859ms · About: xarray-datasette