Skip to content

Commit

Permalink
Merge a6ec07d into 33669de
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Mar 4, 2020
2 parents 33669de + a6ec07d commit 15254e4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions holoviews/core/util.py
Expand Up @@ -84,8 +84,8 @@ def __cmp__(self, other):
pd = None

if pd:
pandas_version = LooseVersion(pd.__version__)
try:
pandas_version = LooseVersion(pd.__version__)
if pandas_version >= '0.24.0':
from pandas.core.dtypes.dtypes import DatetimeTZDtype as DatetimeTZDtypeType
from pandas.core.dtypes.generic import ABCSeries, ABCIndexClass
Expand Down Expand Up @@ -868,13 +868,21 @@ def isfinite(val):
elif val.dtype.kind == 'O':
return np.array([isfinite(v) for v in val], dtype=bool)
elif val.dtype.kind in 'US':
return np.ones_like(val, dtype=bool)
return np.isfinite(val)
return ~pd.isna(val) if pd else np.ones_like(val, dtype=bool)
finite = np.isfinite(val)
if pd and pandas_version >= '1.0.0':
finite &= ~pd.isna(val)
return finite
elif isinstance(val, datetime_types+timedelta_types):
return not isnat(val)
elif isinstance(val, basestring):
return True
return np.isfinite(val)
finite = np.isfinite(val)
if pd and pandas_version >= '1.0.0':
if finite is pd.NA:
return False
return finite & (~pd.isna(val))
return finite


def isdatetime(value):
Expand Down

0 comments on commit 15254e4

Please sign in to comment.