Skip to content

Commit 5465f54

Browse files
add test to check type of df column after loc() (#47264)
* add test * double quotes * fixes * remove pd * fix index type
1 parent d489393 commit 5465f54

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/indexing/test_loc.py

+9
Original file line numberDiff line numberDiff line change
@@ -2869,6 +2869,15 @@ def test_loc_setitem_using_datetimelike_str_as_index(fill_val, exp_dtype):
28692869
tm.assert_index_equal(df.index, expected_index, exact=True)
28702870

28712871

2872+
def test_loc_set_int_dtype():
2873+
# GH#23326
2874+
df = DataFrame([list("abc")])
2875+
df.loc[:, "col1"] = 5
2876+
2877+
expected = DataFrame({0: ["a"], 1: ["b"], 2: ["c"], "col1": [5]})
2878+
tm.assert_frame_equal(df, expected)
2879+
2880+
28722881
class TestLocSeries:
28732882
@pytest.mark.parametrize("val,expected", [(2**63 - 1, 3), (2**63, 4)])
28742883
def test_loc_uint64(self, val, expected):

0 commit comments

Comments
 (0)