Skip to content
Prev Previous commit
Next Next commit
rename test + move check
  • Loading branch information
ivirshup committed Dec 1, 2021
commit fc9048d9c6942ad19d65101a460b29c95da55504
4 changes: 2 additions & 2 deletions pandas/core/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,6 @@ def sanitize_array(
"""
if isinstance(data, ma.MaskedArray):
data = sanitize_masked_array(data)
elif isinstance(data, np.matrix):
data = data.A

if isinstance(dtype, PandasDtype):
# Avoid ending up with a PandasArray
Expand All @@ -525,6 +523,8 @@ def sanitize_array(

# GH#846
if isinstance(data, np.ndarray):
if isinstance(data, np.matrix):
data = data.A

if dtype is not None and is_float_dtype(data.dtype) and is_integer_dtype(dtype):
# possibility of nan -> garbage
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/indexing/test_setitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ def test_boolean_mask_nullable_int64(self):
)
tm.assert_frame_equal(result, expected)

def test_2d_array(self):
def test_setitem_npmatrix_2d(self):
# for use-case df["x"] = sparse.random(10, 10).mean(axis=1)
expected = DataFrame(
{"np-array": np.ones(10), "np-matrix": np.ones(10)}, index=np.arange(10)
Expand Down