Skip to content

Commit

Permalink
Fixed array and dict interface validation
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Dec 19, 2017
1 parent fe91129 commit c0b09b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion holoviews/core/data/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def init(cls, eltype, data, kdims, vdims):
for k, v in dict_data))
data = np.column_stack(dataset)
elif isinstance(data, tuple):
data = [d if isinstance(d, np.ndarray) else np.array(d) for d in data]
data = [np.asarray(d) for d in data]
if any(arr.ndim > 1 for arr in data):
raise ValueError('ArrayInterface expects data to be of flat shape.')
if cls.expanded(data):
Expand Down
5 changes: 3 additions & 2 deletions holoviews/core/data/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ def init(cls, eltype, data, kdims, vdims):
for i, sd in enumerate(d):
unpacked.append((sd, vals[:, i]))
else:
if not vals.ndim == 1:
vals = vals if np.isscalar(vals) else np.asarray(vals)
if not np.isscalar(vals) and not vals.ndim == 1:
raise ValueError('DictInterface expects data for each column to be flat.')
unpacked.append((d, vals if np.isscalar(vals) else np.asarray(vals)))
unpacked.append((d, vals))
if not cls.expanded([d[1] for d in unpacked if not np.isscalar(d[1])]):
raise ValueError('DictInterface expects data to be of uniform shape.')
if isinstance(data, odict_types):
Expand Down

0 comments on commit c0b09b2

Please sign in to comment.