Skip to content

Commit 2fdb97d

Browse files
committed
CLN: change lambdas to normal function definitions
1 parent 52c5267 commit 2fdb97d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pandas/tests/frame/test_constructors.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,11 @@ def test_constructor_dict_of_tuples(self):
501501
tm.assert_frame_equal(result, expected, check_dtype=False)
502502

503503
def test_constructor_dict_multiindex(self):
504-
check = lambda result, expected: tm.assert_frame_equal(
505-
result, expected, check_dtype=True, check_index_type=True,
506-
check_column_type=True, check_names=True)
504+
def check(result, expected):
505+
return tm.assert_frame_equal(result, expected, check_dtype=True,
506+
check_index_type=True,
507+
check_column_type=True,
508+
check_names=True)
507509
d = {('a', 'a'): {('i', 'i'): 0, ('i', 'j'): 1, ('j', 'i'): 2},
508510
('b', 'a'): {('i', 'i'): 6, ('i', 'j'): 5, ('j', 'i'): 4},
509511
('b', 'c'): {('i', 'i'): 7, ('i', 'j'): 8, ('j', 'i'): 9}}

pandas/tests/frame/test_indexing.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ def test_setitem_callable(self):
224224

225225
def test_setitem_other_callable(self):
226226
# GH 13299
227-
inc = lambda x: x + 1
227+
def inc(x):
228+
return x + 1
228229

229230
df = pd.DataFrame([[-1, 1], [1, -1]])
230231
df[df > 0] = inc
@@ -2083,7 +2084,8 @@ def test_reindex_level(self):
20832084
icol = ['jim', 'joe', 'jolie']
20842085

20852086
def verify_first_level(df, level, idx, check_index_type=True):
2086-
f = lambda val: np.nonzero(df[level] == val)[0]
2087+
def f(val):
2088+
return np.nonzero(df[level] == val)[0]
20872089
i = np.concatenate(list(map(f, idx)))
20882090
left = df.set_index(icol).reindex(idx, level=level)
20892091
right = df.iloc[i].set_index(icol)

0 commit comments

Comments
 (0)