ValueError Traceback (most recent call last) <ipython-input-64-56a70bbb0400> in <module> 7 plt.title('2020级外国语学院各班级总学时') 8 plt.subplot(222) ----> 9 sns.barplot(x=bj_sp_new_sort1.index,y=bj_sp_new_sort1.学时) 10 plt.xticks(rotation=90) 11 plt.title('2020级食品与工程学院各班级总学时') D:\Users\h\anaconda3\lib\site-packages\seaborn\_decorators.py in inner_f(*args, **kwargs) 44 ) 45 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)}) ---> 46 return f(**kwargs) 47 return inner_f 48 D:\Users\h\anaconda3\lib\site-packages\seaborn\categorical.py in barplot(x, y, hue, data, order, hue_order, estimator, ci, n_boot, units, seed, orient, color, palette, saturation, errcolor, errwidth, capsize, dodge, ax, **kwargs) 3177 ): 3178 -> 3179 plotter = _BarPlotter(x, y, hue, data, order, hue_order, 3180 estimator, ci, n_boot, units, seed, 3181 orient, color, palette, saturation, D:\Users\h\anaconda3\lib\site-packages\seaborn\categorical.py in __init__(self, x, y, hue, data, order, hue_order, estimator, ci, n_boot, units, seed, orient, color, palette, saturation, errcolor, errwidth, capsize, dodge) 1584 self.establish_variables(x, y, hue, data, orient, 1585 order, hue_order, units) -> 1586 self.establish_colors(color, palette, saturation) 1587 self.estimate_statistic(estimator, ci, n_boot, seed) 1588 D:\Users\h\anaconda3\lib\site-packages\seaborn\categorical.py in establish_colors(self, color, palette, saturation) 317 # Determine the gray color to use for the lines framing the plot 318 light_vals = [colorsys.rgb_to_hls(*c)[1] for c in rgb_colors] --> 319 lum = min(light_vals) * .6 320 gray = mpl.colors.rgb2hex((lum, lum, lum)) 321 ValueError: min() arg is an empty sequence
时间: 2024-04-03 09:35:13 浏览: 226
2-3-python编程基础知识-基本数据类型.ppt
根据你提供的错误信息,可以看出是在运行 `sns.barplot(x=bj_sp_new_sort1.index,y=bj_sp_new_sort1.学时)` 这一行代码时出现了 ValueError,报错信息是 `min() arg is an empty sequence`,意思是 `min()` 函数的参数是一个空序列,无法进行计算。这说明可能是 `bj_sp_new_sort1` 这个 DataFrame 中的数据为空,导致无法绘制柱状图。你可以检查一下 `bj_sp_new_sort1` 中是否存在空值或者缺失值。
阅读全文