'MatplotlibDeprecationWarning' - 尝试绘制直方图时发出警告

Jea*_*rdi 8 python matplotlib pandas

我试图用它matplotlib来绘制直方图,但不断遇到此错误:

MatplotlibDeprecationWarning: The resize_event function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use callbacks.process('resize_event', ResizeEvent(...)) instead.

这是我的代码;也欢迎有关如何清理逻辑表达式的反馈。

lower_quartile = df['2020 Population'].quantile(0.25)
mid_quartile = df['2020 Population'].quantile(0.5)
upper_quartile = df['2020 Population'].quantile(0.75)

new_data = df.loc[df['2020 Population'] > lower_quartile]

final_2020_range = new_data.loc[df['2020 Population'] < upper_quartile]

check = final_2020_range['2020 Population']

plt.hist(check)
Run Code Online (Sandbox Code Playgroud)

小智 5

似乎您可以在这里找到答案: https ://github.com/matplotlib/matplotlib/issues/23921

简而言之:这是一个bug,将在3.6.1中修复