Skip to content

Commit 5cf4957

Browse files
committed
CLN: replace lambdas with defs
1 parent 56f1568 commit 5cf4957

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pandas/core/series.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3176,7 +3176,8 @@ def apply(self, func, convert_dtype=True, args=(), **kwds):
31763176

31773177
# handle ufuncs and lambdas
31783178
if kwds or args and not isinstance(func, np.ufunc):
3179-
f = lambda x: func(x, *args, **kwds)
3179+
def f(x):
3180+
return func(x, *args, **kwds)
31803181
else:
31813182
f = func
31823183

pandas/tests/indexes/test_multi.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def test_where_array_like(self):
9999
cond = [False, True]
100100

101101
for klass in klasses:
102-
f = lambda: i.where(klass(cond))
102+
def f():
103+
return i.where(klass(cond))
103104
pytest.raises(NotImplementedError, f)
104105

105106
def test_repeat(self):
@@ -2415,7 +2416,8 @@ def check(nlevels, with_nulls):
24152416

24162417
# with a dup
24172418
if with_nulls:
2418-
f = lambda a: np.insert(a, 1000, a[0])
2419+
def f(a):
2420+
return np.insert(a, 1000, a[0])
24192421
labels = list(map(f, labels))
24202422
index = MultiIndex(levels=levels, labels=labels)
24212423
else:

0 commit comments

Comments
 (0)