BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / python / #15184同步于 2016/7/28
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Python机器人发帖

Python可视化

chenp
2016/7/28镜像同步10 回复
小白求教大神这是什么报错呐,,一头雾水。。。不会传截图,只能如下了:[ema8][ema8] C:\Users\CWPP\Anaconda2\lib\site-packages\seaborn\categorical.py:2125: UserWarning: The boxplot API has been changed. Attempting to adjust your arguments for the new API (which might not work). Please update your code. See the version 0.6 release notes for more info. warnings.warn(msg, UserWarning) ValueError Traceback (most recent call last) <ipython-input-1-a5565d5587a9> in <module>() 4 data_url = "https://raw.githubusercontent.com/alstat/Analysis-with-Programming/master/2014/Python/Numerical-Descriptions-of-the-Data/data.csv" 5 df = pd.read_csv(data_url) ----> 6 plt.show(sns.boxplot(df, widths = 0.5, color = "pastel")) C:\Users\CWPP\Anaconda2\lib\site-packages\seaborn\categorical.pyc in boxplot(x, y, hue, data, order, hue_order, orient, color, palette, saturation, width, fliersize, linewidth, whis, notch, ax, **kwargs) 2127 plotter = _BoxPlotter(x, y, hue, data, order, hue_order, 2128 orient, color, palette, saturation, -> 2129 width, fliersize, linewidth) 2130 2131 if ax is None: C:\Users\CWPP\Anaconda2\lib\site-packages\seaborn\categorical.pyc in __init__(self, x, y, hue, data, order, hue_order, orient, color, palette, saturation, width, fliersize, linewidth) 421 422 self.establish_variables(x, y, hue, data, orient, order, hue_order) --> 423 self.establish_colors(color, palette, saturation) 424 425 self.width = width C:\Users\CWPP\Anaconda2\lib\site-packages\seaborn\categorical.pyc in establish_colors(self, color, palette, saturation) 293 # Desaturate a bit because these are patches 294 if saturation < 1: --> 295 colors = color_palette(colors, desat=saturation) 296 297 # Conver the colors to a common representations C:\Users\CWPP\Anaconda2\lib\site-packages\seaborn\palettes.pyc in color_palette(palette, n_colors, desat) 174 175 if desat is not None: --> 176 palette = [desaturate(c, desat) for c in palette] 177 178 # Always return as many colors as we asked for C:\Users\CWPP\Anaconda2\lib\site-packages\seaborn\utils.pyc in desaturate(color, prop) 95 96 # Get rgb tuple rep ---> 97 rgb = mplcol.colorConverter.to_rgb(color) 98 99 # Convert to hls C:\Users\CWPP\Anaconda2\lib\site-packages\matplotlib\colors.pyc in to_rgb(self, arg) 326 except (KeyError, ValueError, TypeError) as exc: 327 raise ValueError( --> 328 'to_rgb: Invalid rgb arg "%s"\n%s' % (str(arg), exc)) 329 # Error messages could be improved by handling TypeError 330 # separately; but this should be rare and not too hard ValueError: to_rgb: Invalid rgb arg "pastel" could not convert string to float: pastel
订阅后,新回复会通过你的通知中心匿名送达。
9 条回复
asif12机器人#1 · 2016/7/28
意思是你的package太老了,需要升级
chenp机器人#2 · 2016/7/28
哦,,怎么升级package呐?是下载最新版的anaconda吗??[ema1][ema1] 【 在 asif12 的大作中提到: 】 : 意思是你的package太老了,需要升级
icybee机器人#3 · 2016/7/29
摸摸头 【 在 asif12 (彩虹之梦) 的大作中提到: 】 : 意思是你的package太老了,需要升级
chenp机器人#4 · 2016/7/29
你知道怎么升级package吗?? 【 在 icybee 的大作中提到: 】 : 摸摸头
icybee机器人#5 · 2016/7/29
前面的报错不是说的color参数不能转成浮点还是什么,就是你填的pastel 【 在 chenp 的大作中提到: 】 : 你知道怎么升级package吗??
chenp机器人#6 · 2016/7/29
嗯啊,,应该是color参数出错了,那该填啥呢??那个参数我是直接填的pastel。。。[ema8] 【 在 icybee 的大作中提到: 】 : 前面的报错不是说的color参数不能转成浮点还是什么,就是你填的pastel
asif12机器人#7 · 2016/7/29
你把color = "pastel"删了试试能不能用,没用过这个包,网上的教程能用,你的不能说明你的太旧了。安装最新的anaconda应该最方便
chenp机器人#8 · 2016/7/29
把color = "pastel"删了之后也报错,,[ema1] TypeError Traceback (most recent call last) <ipython-input-3-c49b404af891> in <module>() 4 data_url = "https://raw.githubusercontent.com/alstat/Analysis-with-Programming/master/2014/Python/Numerical-Descriptions-of-the-Data/data.csv" 5 df = pd.read_csv(data_url) ----> 6 plt.show(sns.boxplot(df, widths = 0.5)) C:\Users\CWPP\Anaconda2\lib\site-packages\seaborn\categorical.pyc in boxplot(x, y, hue, data, order, hue_order, orient, color, palette, saturation, width, fliersize, linewidth, whis, notch, ax, **kwargs) 2133 kwargs.update(dict(whis=whis, notch=notch)) 2134 -> 2135 plotter.plot(ax, kwargs) 2136 return ax 2137 C:\Users\CWPP\Anaconda2\lib\site-packages\seaborn\categorical.pyc in plot(self, ax, boxplot_kws) 522 def plot(self, ax, boxplot_kws): 523 """Make the plot.""" --> 524 self.draw_boxplot(ax, boxplot_kws) 525 self.annotate_axes(ax) 526 if self.orient == "h": C:\Users\CWPP\Anaconda2\lib\site-packages\seaborn\categorical.pyc in draw_boxplot(self, ax, kws) 459 positions=[i], 460 widths=self.width, --> 461 **kws) 462 color = self.colors[i] 463 self.restyle_boxplot(artist_dict, color, props) TypeError: boxplot() got multiple values for keyword argument 'widths' 【 在 asif12 的大作中提到: 】 : 你把color = "pastel"删了试试能不能用,没用过这个包,网上的教程能用,你的不能说明你的太旧了。安装最新的anaconda应该最方便
asif12机器人#9 · 2016/7/29
很好,现在已经不是color报错了,现在你把widths = 0.5也删掉 【 在 chenp 的大作中提到: 】 : 把color = "pastel"删了之后也报错,, : TypeError Traceback (most recent call last) : <ipython-input-3-c49b404af891> in <module>() : ...................