Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions pandas/tests/indexing/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2970,6 +2970,28 @@ def test_loc_periodindex_3_levels():
assert mi_series.loc[(p_index[0], "A", "B")] == 1.0


def test_loc_setitem_pyarrow_strings():
# GH#52319
pytest.importorskip("pyarrow")
df = DataFrame(
{
"strings": Series(["A", "B", "C"], dtype="string[pyarrow]"),
"ids": Series([True, True, False]),
}
)
new_value = Series(["X", "Y"])
df.loc[df.ids, "strings"] = new_value

expected_df = DataFrame(
{
"strings": Series(["X", "Y", "C"], dtype="string[pyarrow]"),
"ids": Series([True, True, False]),
}
)

tm.assert_frame_equal(df, expected_df)


class TestLocSeries:
@pytest.mark.parametrize("val,expected", [(2**63 - 1, 3), (2**63, 4)])
def test_loc_uint64(self, val, expected):
Expand Down