diff --git a/pandas/core/groupby/generic.py b/pandas/core/groupby/generic.py index 16732f5421df7..109227633cfdd 100644 --- a/pandas/core/groupby/generic.py +++ b/pandas/core/groupby/generic.py @@ -332,7 +332,7 @@ def _aggregate_multiple_funcs(self, arg) -> DataFrame: from pandas import concat res_df = concat( - results.values(), axis=1, keys=[key.label for key in results.keys()] + results.values(), axis=1, keys=[key.label for key in results] ) return res_df diff --git a/pandas/io/clipboard/__init__.py b/pandas/io/clipboard/__init__.py index 2867f1b067b2d..85fae6da07827 100644 --- a/pandas/io/clipboard/__init__.py +++ b/pandas/io/clipboard/__init__.py @@ -608,7 +608,7 @@ def set_clipboard(clipboard): } if clipboard not in clipboard_types: - allowed_clipboard_types = [repr(_) for _ in clipboard_types.keys()] + allowed_clipboard_types = [repr(_) for _ in clipboard_types] raise ValueError( f"Argument must be one of {', '.join(allowed_clipboard_types)}" ) diff --git a/pandas/io/formats/style_render.py b/pandas/io/formats/style_render.py index 6d815b43a9bcd..035c5d88a7f4b 100644 --- a/pandas/io/formats/style_render.py +++ b/pandas/io/formats/style_render.py @@ -2284,7 +2284,7 @@ def color(value, user_arg, command, comm_arg): if isinstance(value, str) and "--latex" in value: # return the style without conversion but drop '--latex' latex_styles.append((attribute, value.replace("--latex", ""))) - if attribute in CONVERTED_ATTRIBUTES.keys(): + if attribute in CONVERTED_ATTRIBUTES: arg = "" for x in ["--wrap", "--nowrap", "--lwrap", "--dwrap", "--rwrap"]: if x in str(value): diff --git a/pandas/tests/reshape/test_pivot.py b/pandas/tests/reshape/test_pivot.py index 8c2c1026d5c82..7f8b8727629e7 100644 --- a/pandas/tests/reshape/test_pivot.py +++ b/pandas/tests/reshape/test_pivot.py @@ -1699,7 +1699,7 @@ def test_pivot_table_with_iterator_values(self, data): ) tm.assert_frame_equal(pivot_values_keys, pivot_values_list) - agg_values_gen = (value for value in aggs.keys()) + agg_values_gen = (value for value in aggs) pivot_values_gen = pivot_table( data, index=["A"], values=agg_values_gen, aggfunc=aggs ) diff --git a/pandas/tests/series/test_api.py b/pandas/tests/series/test_api.py index 5a66597bdb314..5214e280718f0 100644 --- a/pandas/tests/series/test_api.py +++ b/pandas/tests/series/test_api.py @@ -180,7 +180,7 @@ def test_unknown_attribute(self): # GH#9680 tdi = pd.timedelta_range(start=0, periods=10, freq="1s") ser = Series(np.random.normal(size=10), index=tdi) - assert "foo" not in ser.__dict__.keys() + assert "foo" not in ser.__dict__ msg = "'Series' object has no attribute 'foo'" with pytest.raises(AttributeError, match=msg): ser.foo diff --git a/pyproject.toml b/pyproject.toml index b6b53f4bfd578..f2ebed97bed50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,7 +79,6 @@ disable = [ "used-before-assignment", # pylint type "C": convention, for programming standard violation - "consider-iterating-dictionary", "consider-using-f-string", "disallowed-name", "import-outside-toplevel",