home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 561539035

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
561539035 MDU6SXNzdWU1NjE1MzkwMzU= 3761 to_dataframe fails if dataarray has dimension 1 743508 open 0     2 2020-02-07T10:05:47Z 2020-02-07T16:37:05Z   CONTRIBUTOR      

The to_dataframe method fails with ValueError if the dataarray has only value

MCVE Code Sample

```python

Your code here

x = np.arange(10) y = np.arange(10)

data = np.zeros((len(x), len(y)))

da = xr.DataArray(data, coords=[x, y], dims=['x', 'y'])

da.sel(x=1,y=1).to_dataframe(name='test') ```

Expected Output

Expect a dataframe with one row

Problem Description

This happened when selecting a single value out of a gridded dataset - in cases where there was only one value output the to_dataframe failed.

Output of xr.show_versions()

# Paste the output here xr.show_versions() here INSTALLED VERSIONS ------------------ commit: None python: 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, 22:33:48) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 5.3.0-28-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.7.1 xarray: 0.14.1 pandas: 0.25.3 numpy: 1.17.5 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.0.4.2 nc_time_axis: None PseudoNetCDF: None rasterio: 1.1.0 cfgrib: 0.9.7.6 iris: None bottleneck: 1.3.1 dask: 2.9.2 distributed: 2.9.3 matplotlib: 3.1.2 cartopy: 0.17.0 seaborn: 0.9.0 numbagg: None setuptools: 45.1.0.post20200119 pip: 20.0.1 conda: None pytest: None IPython: 7.11.1 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3761/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

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