Skip to content

Commit 57cca51

Browse files
committed
Merge pull request #7881 from jreback/apply_optimize
PERF: groupby / frame apply optimization
2 parents 9857a0e + f6f84db commit 57cca51

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pandas/core/groupby.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,11 @@ def apply(self, func, *args, **kwargs):
635635

636636
@wraps(func)
637637
def f(g):
638-
# ignore SettingWithCopy here in case the user mutates
639-
with option_context('mode.chained_assignment',None):
640-
return func(g, *args, **kwargs)
638+
return func(g, *args, **kwargs)
641639

642-
return self._python_apply_general(f)
640+
# ignore SettingWithCopy here in case the user mutates
641+
with option_context('mode.chained_assignment',None):
642+
return self._python_apply_general(f)
643643

644644
def _python_apply_general(self, f):
645645
keys, values, mutated = self.grouper.apply(f, self._selected_obj,

pandas/io/tests/test_data.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,10 @@ def test_fred(self):
445445
end = datetime(2013, 1, 27)
446446

447447
received = web.DataReader("GDP", "fred", start, end)['GDP'].tail(1)[0]
448-
self.assertEqual(int(received), 16535)
448+
449+
# < 7/30/14 16535 was returned
450+
#self.assertEqual(int(received), 16535)
451+
self.assertEqual(int(received), 16502)
449452

450453
self.assertRaises(Exception, web.DataReader, "NON EXISTENT SERIES",
451454
'fred', start, end)

0 commit comments

Comments
 (0)