diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index b3650173e41ef..980e8b4936c4e 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -133,7 +133,7 @@ def _cat_compare_op(op): opname = f"__{op.__name__}__" - fill_value = True if op is operator.ne else False + fill_value = op is operator.ne @unpack_zerodim_and_defer(opname) def func(self, other): diff --git a/pandas/core/window/ewm.py b/pandas/core/window/ewm.py index 9e5437a084695..fb308fd8ba620 100644 --- a/pandas/core/window/ewm.py +++ b/pandas/core/window/ewm.py @@ -1002,7 +1002,7 @@ def mean(self, *args, update=None, update_times=None, **kwargs): 1 0.75 5.75 """ result_kwargs = {} - is_frame = True if self._selected_obj.ndim == 2 else False + is_frame = self._selected_obj.ndim == 2 if update_times is not None: raise NotImplementedError("update_times is not implemented.") else: diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index 0e7174c6ad765..f3c58ac2ad18d 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -2958,10 +2958,7 @@ def hide( setattr( self, f"hide_{objs}_", - [ - True if lev in levels_ else False - for lev in range(getattr(self, objs).nlevels) - ], + [lev in levels_ for lev in range(getattr(self, objs).nlevels)], ) else: if axis == 0: diff --git a/pandas/tests/copy_view/test_indexing.py b/pandas/tests/copy_view/test_indexing.py index d917a3c79aa97..6abd54db3bf4a 100644 --- a/pandas/tests/copy_view/test_indexing.py +++ b/pandas/tests/copy_view/test_indexing.py @@ -339,10 +339,9 @@ def test_subset_set_column_with_loc(using_copy_on_write, using_array_manager, dt with pd.option_context("chained_assignment", "warn"): # The (i)loc[:, col] inplace deprecation gets triggered here, ignore those # warnings and only assert the SettingWithCopyWarning - raise_on_extra_warnings = False if using_array_manager else True with tm.assert_produces_warning( SettingWithCopyWarning, - raise_on_extra_warnings=raise_on_extra_warnings, + raise_on_extra_warnings=not using_array_manager, ): subset.loc[:, "a"] = np.array([10, 11], dtype="int64") @@ -376,10 +375,9 @@ def test_subset_set_column_with_loc2(using_copy_on_write, using_array_manager): with pd.option_context("chained_assignment", "warn"): # The (i)loc[:, col] inplace deprecation gets triggered here, ignore those # warnings and only assert the SettingWithCopyWarning - raise_on_extra_warnings = False if using_array_manager else True with tm.assert_produces_warning( SettingWithCopyWarning, - raise_on_extra_warnings=raise_on_extra_warnings, + raise_on_extra_warnings=not using_array_manager, ): subset.loc[:, "a"] = 0 diff --git a/pyproject.toml b/pyproject.toml index b6c657dfd8b15..b38a3f3de21c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -124,7 +124,6 @@ disable = [ "no-else-return", "no-self-use", "redefined-argument-from-local", - "simplifiable-if-expression", "too-few-public-methods", "too-many-ancestors", "too-many-arguments",