Repository: pandas-dev/pandas

Issue:
QST: pd.series indexing True auto 0 change
### Research

- [X] I have searched the [[pandas] tag](https://stackoverflow.com/questions/tagged/pandas) on StackOverflow for similar questions.

- [X] I have asked my usage related question on [StackOverflow](https://stackoverflow.com).


### Link to question on StackOverflow

https://stackoverflow.com/questions/73783112/1-4-4-other-1-5-0-pd-series-indexing-true-auto-0-change

### Question about pandas

```python
test = pd.Series({True: 0, False: 0})

1.4.4
print(test[0])
> 0

but 
1.5.0
print(test[True])

> keyerror 0
```

1.4.4 and 1.5.0 What has changed?I can't find it


Discussion:
Hi, thanks for your report. ``test[True]`` works for me while ``test[0]`` does not. We are now supporting a boolean index, see #45061

@jbrockmendel I guess this is the correct behavior now?
test.loc[1] should definitely raise, but it may be that test.index._should_fallback_to_positional should be True, in which case the `__getitem__` call should still work (but would have different behavior on `test[::-1]`)

Patch:
diff --git a/doc/source/whatsnew/v1.5.1.rst b/doc/source/whatsnew/v1.5.1.rst
index da0bd746e3da5..6936baee5a9f8 100644
--- a/doc/source/whatsnew/v1.5.1.rst
+++ b/doc/source/whatsnew/v1.5.1.rst
@@ -82,6 +82,7 @@ Fixed regressions
 
 Bug fixes
 ~~~~~~~~~
+- Bug in :meth:`Series.__getitem__` not falling back to positional for integer keys and boolean :class:`Index` (:issue:`48653`)
 - Bug in :meth:`DataFrame.to_hdf` raising ``AssertionError`` with boolean index (:issue:`48667`)
 - Bug in :meth:`DataFrame.pivot_table` raising unexpected ``FutureWarning`` when setting datetime column as index (:issue:`48683`)
 -
diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py
index 7dc04474cbcd8..e061c91bb7321 100644
--- a/pandas/core/indexes/base.py
+++ b/pandas/core/indexes/base.py
@@ -6017,7 +6017,7 @@ def _should_fallback_to_positional(self) -> bool:
         """
         Should an integer key be treated as positional?
         """
-        return not self.holds_integer() and not self.is_boolean()
+        return not self.holds_integer()
 
     def _get_values_for_loc(self, series: Series, loc, key):
         """


Test patch:
diff --git a/pandas/tests/series/indexing/test_getitem.py b/pandas/tests/series/indexing/test_getitem.py
index 111c1652240e2..cc67dd9caeea9 100644
--- a/pandas/tests/series/indexing/test_getitem.py
+++ b/pandas/tests/series/indexing/test_getitem.py
@@ -201,6 +201,12 @@ def test_getitem_str_with_timedeltaindex(self):
         with pytest.raises(KeyError, match=msg):
             ser["50 days"]
 
+    def test_getitem_bool_index_positional(self):
+        # GH#48653
+        ser = Series({True: 1, False: 0})
+        result = ser[0]
+        assert result == 1
+
 
 class TestSeriesGetitemSlices:
     def test_getitem_partial_str_slice_with_datetimeindex(self):
diff --git a/pandas/tests/series/indexing/test_indexing.py b/pandas/tests/series/indexing/test_indexing.py
index 0bab391dab27d..e3df9671e6c64 100644
--- a/pandas/tests/series/indexing/test_indexing.py
+++ b/pandas/tests/series/indexing/test_indexing.py
@@ -367,6 +367,13 @@ def test_loc_setitem_nested_data_enlargement():
     tm.assert_series_equal(ser, expected)
 
 
+def test_getitem_bool_int_key():
+    # GH#48653
+    ser = Series({True: 1, False: 0})
+    with pytest.raises(KeyError, match="0"):
+        ser.loc[0]
+
+
 class TestDeprecatedIndexers:
     @pytest.mark.parametrize("key", [{1}, {1: 1}])
     def test_getitem_dict_and_set_deprecated(self, key):