Skip to content

Commit

Permalink
Improved error message for DataArray without name
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Dec 11, 2017
1 parent 9b6a898 commit 391154f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions holoviews/core/data/xarray.py
Expand Up @@ -50,9 +50,18 @@ def init(cls, eltype, data, kdims, vdims):
vdim = vdims[0]
elif len(vdim_param.default) == 1:
vdim = vdim_param.default[0]
if vdim.name in data.dims:
raise DataError("xarray DataArray does not define a name, "
"and the default of '%s' clashes with a "
"coordinate dimension. Give the DataArray "
"a name or supply an explicit value dimension."
% vdim.name, cls)
else:
raise DataError("If xarray DataArray does not define a name "
"an explicit vdim must be supplied.", cls)
raise DataError("xarray DataArray does not define a name "
"and %s does not define a default value "
"dimension. Give the DataArray a name or "
"supply an explicit vdim." % eltype.__name__,
cls)
vdims = [vdim]
if not kdims:
kdims = [Dimension(d) for d in data.dims[::-1]]
Expand Down

0 comments on commit 391154f

Please sign in to comment.