Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Interface improvements #2767

Merged
merged 5 commits into from
Jun 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions holoviews/core/data/interface.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import param
import numpy as np

Expand Down Expand Up @@ -248,14 +250,18 @@ def select_mask(cls, dataset, selection):
k = slice(*k)
arr = cls.values(dataset, dim)
if isinstance(k, slice):
if k.start is not None:
mask &= k.start <= arr
if k.stop is not None:
mask &= arr < k.stop
with warnings.catch_warnings():
warnings.filterwarnings('ignore', r'invalid value encountered')
if k.start is not None:
mask &= k.start <= arr
if k.stop is not None:
mask &= arr < k.stop
elif isinstance(k, (set, list)):
iter_slcs = []
for ik in k:
iter_slcs.append(arr == ik)
with warnings.catch_warnings():
warnings.filterwarnings('ignore', r'invalid value encountered')
iter_slcs.append(arr == ik)
mask &= np.logical_or.reduce(iter_slcs)
elif callable(k):
mask &= k(arr)
Expand Down
3 changes: 3 additions & 0 deletions holoviews/element/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ def trisurface(self, kdims=None, vdims=None, groupby=None, **kwargs):
def vectorfield(self, kdims=None, vdims=None, groupby=None, **kwargs):
return self(VectorField, kdims, vdims, groupby, **kwargs)

def violin(self, kdims=None, vdims=None, groupby=None, **kwargs):
return self(Violin, kdims, vdims, groupby, **kwargs)


Dataset._conversion_interface = ElementConversion

Expand Down
4 changes: 3 additions & 1 deletion holoviews/operation/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from ..core import Operation, Element
from ..core.data import PandasInterface
from ..core.util import pandas_version
from ..element import Scatter


Expand Down Expand Up @@ -49,7 +50,8 @@ def _process_layer(self, element, key=None):
df = df.set_index(xdim).rolling(win_type=self.p.window_type,
**self._roll_kwargs())
if self.p.window_type is None:
rolled = df.apply(self.p.function)
kwargs = {'raw': True} if pandas_version >= '0.23.0' else {}
rolled = df.apply(self.p.function, **kwargs)
else:
if self.p.function is np.mean:
rolled = df.mean()
Expand Down