Skip to content

Commit c71be03

Browse files
committed
TST: Add test for apply cast types GH#9506
Signed-off-by: Liang Yan <[email protected]>
1 parent 4149f32 commit c71be03

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pandas/tests/apply/test_series_apply.py

+13
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,19 @@ def test_apply_empty_integer_series_with_datetime_index(by_row):
271271
tm.assert_series_equal(result, s)
272272

273273

274+
def test_apply_dataframe_iloc():
275+
uintDF = DataFrame(np.uint64([1, 2, 3, 4, 5]), columns=["Numbers"])
276+
indexDF = DataFrame([2, 3, 2, 1, 2], columns=["Indices"])
277+
278+
def retrieve(targetRow, targetDF):
279+
val = targetDF["Numbers"].iloc[targetRow]
280+
return val
281+
282+
result = indexDF["Indices"].apply(retrieve, args=(uintDF,))
283+
expected = Series([3, 4, 3, 2, 3], name="Indices", dtype="uint64")
284+
tm.assert_series_equal(result, expected)
285+
286+
274287
def test_transform(string_series, by_row):
275288
# transforming functions
276289

0 commit comments

Comments
 (0)