Skip to content

Commit 73f14ab

Browse files
authored
DOC fixes pandas deprecation warning in plot_partial_dependence (scikit-learn#27450)
1 parent 08b123f commit 73f14ab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/inspection/plot_partial_dependence.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@
110110
xtick_start, xtick_period = 6, 12
111111

112112
fig, axs = plt.subplots(nrows=2, figsize=(8, 6), sharey=True, sharex=True)
113-
average_bike_rentals = bikes.frame.groupby(["year", "season", "weekday", "hour"]).mean(
114-
numeric_only=True
115-
)["count"]
113+
average_bike_rentals = bikes.frame.groupby(
114+
["year", "season", "weekday", "hour"], observed=True
115+
).mean(numeric_only=True)["count"]
116116
for ax, (idx, df) in zip(axs, average_bike_rentals.groupby("year")):
117-
df.groupby("season").plot(ax=ax, legend=True)
117+
df.groupby("season", observed=True).plot(ax=ax, legend=True)
118118

119119
# decorate the plot
120120
ax.set_xticks(

0 commit comments

Comments
 (0)