Skip to content

Commit a7341b3

Browse files
authored
STYLE: fix pylint consider-iterating-dictionary warnings (#49305)
1 parent 74c4cd1 commit a7341b3

File tree

6 files changed

+5
-6
lines changed

6 files changed

+5
-6
lines changed

pandas/core/groupby/generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def _aggregate_multiple_funcs(self, arg) -> DataFrame:
332332
from pandas import concat
333333

334334
res_df = concat(
335-
results.values(), axis=1, keys=[key.label for key in results.keys()]
335+
results.values(), axis=1, keys=[key.label for key in results]
336336
)
337337
return res_df
338338

pandas/io/clipboard/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ def set_clipboard(clipboard):
608608
}
609609

610610
if clipboard not in clipboard_types:
611-
allowed_clipboard_types = [repr(_) for _ in clipboard_types.keys()]
611+
allowed_clipboard_types = [repr(_) for _ in clipboard_types]
612612
raise ValueError(
613613
f"Argument must be one of {', '.join(allowed_clipboard_types)}"
614614
)

pandas/io/formats/style_render.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2284,7 +2284,7 @@ def color(value, user_arg, command, comm_arg):
22842284
if isinstance(value, str) and "--latex" in value:
22852285
# return the style without conversion but drop '--latex'
22862286
latex_styles.append((attribute, value.replace("--latex", "")))
2287-
if attribute in CONVERTED_ATTRIBUTES.keys():
2287+
if attribute in CONVERTED_ATTRIBUTES:
22882288
arg = ""
22892289
for x in ["--wrap", "--nowrap", "--lwrap", "--dwrap", "--rwrap"]:
22902290
if x in str(value):

pandas/tests/reshape/test_pivot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ def test_pivot_table_with_iterator_values(self, data):
16991699
)
17001700
tm.assert_frame_equal(pivot_values_keys, pivot_values_list)
17011701

1702-
agg_values_gen = (value for value in aggs.keys())
1702+
agg_values_gen = (value for value in aggs)
17031703
pivot_values_gen = pivot_table(
17041704
data, index=["A"], values=agg_values_gen, aggfunc=aggs
17051705
)

pandas/tests/series/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def test_unknown_attribute(self):
180180
# GH#9680
181181
tdi = pd.timedelta_range(start=0, periods=10, freq="1s")
182182
ser = Series(np.random.normal(size=10), index=tdi)
183-
assert "foo" not in ser.__dict__.keys()
183+
assert "foo" not in ser.__dict__
184184
msg = "'Series' object has no attribute 'foo'"
185185
with pytest.raises(AttributeError, match=msg):
186186
ser.foo

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ disable = [
7979
"used-before-assignment",
8080

8181
# pylint type "C": convention, for programming standard violation
82-
"consider-iterating-dictionary",
8382
"consider-using-f-string",
8483
"disallowed-name",
8584
"import-outside-toplevel",

0 commit comments

Comments
 (0)