Skip to content
Merged
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
11 changes: 5 additions & 6 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3342,6 +3342,7 @@ def _apply_standard(self, func, axis, ignore_failures=False, reduce=True):
else: # pragma : no cover
raise AssertionError('Axis must be 0 or 1, got %s' % str(axis))

i = None
keys = []
results = {}
if ignore_failures:
Expand All @@ -3362,14 +3363,12 @@ def _apply_standard(self, func, axis, ignore_failures=False, reduce=True):
results[i] = func(v)
keys.append(v.name)
except Exception as e:
try:
if hasattr(e, 'args'):
if hasattr(e, 'args'):
# make sure i is defined
if i is not None:
k = res_index[i]
e.args = e.args + ('occurred at index %s' %
com.pprint_thing(k),)
except (NameError, UnboundLocalError): # pragma: no cover
# no k defined yet
pass
com.pprint_thing(k),)
raise

if len(results) > 0 and _is_sequence(results[0]):
Expand Down