Skip to content

Commit

Permalink
Handled empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Feb 15, 2018
1 parent 3a8b71a commit ca2382e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions holoviews/core/data/interface.py
Expand Up @@ -290,6 +290,8 @@ def range(cls, dataset, dimension):
return (np.nanmin(column), np.nanmax(column))
except TypeError:
column = [v for v in util.python2sort(column) if v is not None]
if not len(column):
return np.NaN, np.NaN
return column[0], column[-1]

@classmethod
Expand Down
10 changes: 10 additions & 0 deletions holoviews/core/data/pandas.py
Expand Up @@ -292,6 +292,16 @@ def dframe(cls, columns, dimensions):
return columns.data.copy()


@classmethod
def array(cls, dataset, dimensions):
if not dimensions:
dimensions = dataset.dimensions(label='name')
else:
dimensions = [dataset.get_dimensions(d).name for d in dimensions]
inds = [dataset.data.columns.index(dim.name) for dim in dimensions]
return dataset.data.values[:, inds]


@classmethod
def iloc(cls, dataset, index):
rows, cols = index
Expand Down

0 comments on commit ca2382e

Please sign in to comment.