需要帮助。我正在做一项需要进行探索性数据分析的任务。
我安装了seaborn。在下方用代码线绘制图表时
chart1 = sns.catplot(x = "JUNCTIONTYPE", data = df3, kind = "count", col= "SEVERITYDESC")
chart1.set_xticklabels(rotation=35, horizontalalignment='right')
我得到以下错误。
ValueError Traceback (most recent call last)
<ipython-input-30-d7f0b1b2a27f> in <module>
----> 1 chart1 = sns.catplot(x = "JUNCTIONTYPE", data = df3, kind = "count", col= "SEVERITYDESC")
2 chart1.set_xticklabels(rotation=35, horizontalalignment='right')
~/conda/envs/python/lib/python3.6/site-packages/seaborn/categorical.py in catplot(x, y, hue, data, row, col, col_wrap, estimator, ci, n_boot, units, order, hue_order, row_order, col_order, kind, height, aspect, orient, color, palette, legend, legend_out, sharex, sharey, margin_titles, facet_kws, **kwargs)
3722 # so we need to define ``palette`` to get default behavior for the
3723 # categorical functions
-> 3724 p.establish_colors(color, palette, 1)
3725 if kind != "point" or hue is not None:
3726 palette = p.colors
~/conda/envs/python/lib/python3.6/site-packages/seaborn/categorical.py in establish_colors(self, color, palette, saturation)
313 # Determine the gray color to use for the lines framing the plot
314 light_vals = [colorsys.rgb_to_hls(*c)[1] for c in rgb_colors]
--> 315 lum = min(light_vals) * .6
316 gray = mpl.colors.rgb2hex((lum, lum, lum))
317
ValueError: min() arg is an empty sequence
以下代码也出现类似错误。不确定我错过了什么。请帮忙。
chart = sns.catplot(x = "COLLISIONTYPE", data = df3, kind = "count", col= "SEVERITYDESC")
chart.set_xticklabels(rotation=65, horizontalalignment='right')
这似乎是seaborn v0.11.0上的一个错误我通过将其降级为v0.10.1 来解决它
如果您正在使用conda:
conda remove seaborn
conda install seaborn==0.10.1
如果你宁愿击败:
pip uninstall seaborn
pip install seaborn==0.10.1