Skip to content

Commit fbc4f7d

Browse files
committed
cicd pipeline
1 parent 8bdde85 commit fbc4f7d

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

pandas/core/groupby/groupby.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,6 @@ def __call__(self, *args, **kwargs):
437437
color = kwargs.get("color", None)
438438
if colormap is not None and color is None:
439439
from pandas.plotting._matplotlib.style import get_standard_colors
440-
441440
group_keys = list(self._groupby.groups.keys())
442441
colors = get_standard_colors(
443442
num_colors=len(group_keys),
@@ -446,19 +445,25 @@ def __call__(self, *args, **kwargs):
446445
)
447446
kwargs = dict(kwargs)
448447
kwargs.pop("colormap", None)
449-
450-
def f(group, color, label):
451-
return group.plot(*args, color=color, label=label, **kwargs)
452-
448+
def f(obj, color=None, label=None):
449+
plot_kwargs = dict(kwargs)
450+
if color is not None:
451+
plot_kwargs["color"] = color
452+
if label is not None:
453+
plot_kwargs["label"] = label
454+
return obj.plot(*args, **plot_kwargs)
453455
results = []
454456
for i, (name, group) in enumerate(self._groupby):
455457
results.append(f(group, colors[i], name))
456458
return results
457459
else:
458-
459-
def f(self):
460-
return self.plot(*args, **kwargs)
461-
460+
def f(obj, color=None, label=None):
461+
plot_kwargs = dict(kwargs)
462+
if color is not None:
463+
plot_kwargs["color"] = color
464+
if label is not None:
465+
plot_kwargs["label"] = label
466+
return obj.plot(*args, **plot_kwargs)
462467
f.__name__ = "plot"
463468
return self._groupby._python_apply_general(f, self._groupby._selected_obj)
464469

0 commit comments

Comments
 (0)