Skip to content

Commit

Permalink
move callable check
Browse files Browse the repository at this point in the history
  • Loading branch information
papajohn committed Feb 7, 2016
1 parent d34f802 commit aa1c8a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions datascience/tables.py
Expand Up @@ -666,8 +666,6 @@ def pivot(self, columns, rows, values=None, collect=None, zero=None):
raise TypeError('collect requires values to be specified')
if values is not None and collect is None:
raise TypeError('values requires collect to be specified')
if collect is not None and not callable(collect):
raise TypeError('collect must be callable (or None)')
rows = self._as_labels(rows)
if values is None:
selected = self.select([columns] + rows)
Expand Down Expand Up @@ -1822,6 +1820,8 @@ def _zero_on_type_error(column_fn):
"""Wrap a function on an np.ndarray to return 0 on a type error."""
if not column_fn:
return column_fn
if not callable(column_fn):
raise TypeError('column functions must be callable')
@functools.wraps(column_fn)
def wrapped(column):
try:
Expand Down

0 comments on commit aa1c8a2

Please sign in to comment.