add test to check type of df column after loc() (#47264) · pandas-dev/pandas@5465f54 (original) (raw)

Original file line number Diff line number Diff line change
@@ -2869,6 +2869,15 @@ def test_loc_setitem_using_datetimelike_str_as_index(fill_val, exp_dtype):
2869 2869 tm.assert_index_equal(df.index, expected_index, exact=True)
2870 2870
2871 2871
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 +
2872 2881 class TestLocSeries:
2873 2882 @pytest.mark.parametrize("val,expected", [(2**63 - 1, 3), (2**63, 4)])
2874 2883 def test_loc_uint64(self, val, expected):