test_indexing.py 498 B

12345678910111213141516171819
  1. import pandas as pd
  2. import pandas._testing as tm
  3. def test_array_setitem_nullable_boolean_mask():
  4. # GH 31446
  5. ser = pd.Series([1, 2], dtype="Int64")
  6. result = ser.where(ser > 1)
  7. expected = pd.Series([pd.NA, 2], dtype="Int64")
  8. tm.assert_series_equal(result, expected)
  9. def test_array_setitem():
  10. # GH 31446
  11. arr = pd.Series([1, 2], dtype="Int64").array
  12. arr[arr > 1] = 1
  13. expected = pd.array([1, 1], dtype="Int64")
  14. tm.assert_extension_array_equal(arr, expected)