Skip to content

Commit c616c68

Browse files
TST: Add test for df.apply(lambda x: x.dtype) (#35072)
1 parent 18b3af6 commit c616c68

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/frame/test_apply.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,3 +1501,12 @@ def test_consistency_of_aggregates_of_columns_with_missing_values(self, df, meth
15011501
tm.assert_series_equal(
15021502
none_in_first_column_result, none_in_second_column_result
15031503
)
1504+
1505+
@pytest.mark.parametrize("col", [1, 1.0, True, "a", np.nan])
1506+
def test_apply_dtype(self, col):
1507+
# GH 31466
1508+
df = pd.DataFrame([[1.0, col]], columns=["a", "b"])
1509+
result = df.apply(lambda x: x.dtype)
1510+
expected = df.dtypes
1511+
1512+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)