Skip to content

Commit

Permalink
neurons.has_...: fix issue with empty data
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Jan 10, 2021
1 parent ab4490d commit a7f98cc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions navis/core/neurons.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,19 @@ def __getattr__(self, key):
key = key[key.index('_') + 1:]
if hasattr(self, key):
data = getattr(self, key)
if isinstance(data, pd.DataFrame) and not data.empty:
return True
if isinstance(data, pd.DataFrame):
if not data.empty:
return True
else:
return False
# This is necessary because np.any does not like strings
elif isinstance(data, str):
if data == 'NA' or not data:
return False
return True
elif np.any(data):
elif utils.is_iterable(data) and len(data) > 0:
return True
elif data:
return True
return False
elif key.startswith('n_'):
Expand Down

0 comments on commit a7f98cc

Please sign in to comment.