Skip to content

Commit a547d2d

Browse files
author
Rajat Jain
committed
test case added.
1 parent 42fe69c commit a547d2d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/arrays/integer/test_dtypes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@ def test_to_numpy_dtype(dtype, in_series):
269269
tm.assert_numpy_array_equal(result, expected)
270270

271271

272+
@pytest.mark.parametrize("dtype", ["int32", "int64"])
273+
def test_nd_array_cast_to_dtype(dtype):
274+
b = pd.DataFrame([['0', '1'], ['2', '3']], dtype="Int64")
275+
result = b.to_numpy(dtype=dtype)
276+
expected = np.array([[0, 1], [2, 3]], dtype=dtype)
277+
tm.assert_numpy_array_equal(result, expected)
278+
279+
272280
@pytest.mark.parametrize("dtype", ["int64", "bool"])
273281
def test_to_numpy_na_raises(dtype):
274282
a = pd.array([0, 1, None], dtype="Int64")

0 commit comments

Comments
 (0)