2016-11-22 3 views
1

Contrairement à ce qui a été dit here, le AttributeError: Unknown property color_cycle est toujours persistant dans la version la plus récente de Pandas (0.19.0-1).Pandas 0.19: Erreur d'attribut "propriété inconnue color_cycle" existe toujours lors de l'exécution de la boîte à moustache

Dans mon cas, j'ai un dataframe semblable à cela, bien que beaucoup plus (3.000.000 lignes):

 A   B C 
1 05010001 17 1 
2 05020001 5 1 
3 05020002 11 1 
4 05020003 2 1 
5 05030001 86 1 
6 07030001 84 2 
7 07030002 10 2 
8 08010001 16 3 

Pour une raison quelconque, si je mets en œuvre ce très exemple, il n'y a aucune erreur. Dans mon cas réel, l'exécution simple

df.boxplot(by='C')

déclenche ce gâchis:

AttributeError       Traceback (most recent call last) 
<ipython-input-51-5c645348f82f> in <module>() 
----> 1 df.boxplot(by='C') 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\core\frame.pyc in boxplot(self, column, by, ax, fontsize, rot, grid, figsize, layout, return_type, **kwds) 
    5514 
    5515   columns = list(data.dtype.names) 
-> 5516   arrays = [data[k] for k in columns] 
    5517   return arrays, columns 
    5518  else: 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\tools\plotting.pyc in boxplot(data, column, by, ax, fontsize, rot, grid, figsize, layout, return_type, **kwds) 
    2687  ax : Matplotlib axes object, optional 
    2688  fontsize : int or string 
-> 2689  rot : label rotation angle 
    2690  figsize : A tuple (width, height) in inches 
    2691  grid : Setting this to True will show the grid 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\tools\plotting.pyc in _grouped_plot_by_column(plotf, data, columns, by, numeric_only, grid, figsize, ax, layout, return_type, **kwargs) 
    3091  >>> df = pandas.DataFrame(data, columns=list('ABCD'), index=index) 
    3092  >>> 
-> 3093  >>> grouped = df.groupby(level='lvl1') 
    3094  >>> boxplot_frame_groupby(grouped) 
    3095  >>> 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\tools\plotting.pyc in plot_group(keys, values, ax) 
    2659  create a figure with the default figsize, causing the figsize=parameter to 
    2660  be ignored. 
-> 2661  """ 
    2662  if ax is None and len(plt.get_fignums()) > 0: 
    2663   ax = _gca() 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\__init__.pyc in inner(ax, *args, **kwargs) 
    1810      warnings.warn(msg % (label_namer, func.__name__), 
    1811         RuntimeWarning, stacklevel=2) 
-> 1812    return func(ax, *args, **kwargs) 
    1813   pre_doc = inner.__doc__ 
    1814   if pre_doc is None: 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_axes.pyc in boxplot(self, x, notch, sym, vert, whis, positions, widths, patch_artist, bootstrap, usermedians, conf_intervals, meanline, showmeans, showcaps, showbox, showfliers, boxprops, labels, flierprops, medianprops, meanprops, capprops, whiskerprops, manage_xticks) 
    3321       meanline=meanline, showfliers=showfliers, 
    3322       capprops=capprops, whiskerprops=whiskerprops, 
-> 3323       manage_xticks=manage_xticks) 
    3324   return artists 
    3325 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_axes.pyc in bxp(self, bxpstats, positions, widths, vert, patch_artist, shownotches, showmeans, showcaps, showbox, showfliers, boxprops, whiskerprops, flierprops, medianprops, capprops, meanprops, meanline, manage_xticks) 
    3650      boxes.extend(dopatch(box_x, box_y, **final_boxprops)) 
    3651     else: 
-> 3652      boxes.extend(doplot(box_x, box_y, **final_boxprops)) 
    3653 
    3654    # draw the whiskers 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_axes.pyc in doplot(*args, **kwargs) 
    3564   if vert: 
    3565    def doplot(*args, **kwargs): 
-> 3566     return self.plot(*args, **kwargs) 
    3567 
    3568    def dopatch(xs, ys, **kwargs): 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\__init__.pyc in inner(ax, *args, **kwargs) 
    1810      warnings.warn(msg % (label_namer, func.__name__), 
    1811         RuntimeWarning, stacklevel=2) 
-> 1812    return func(ax, *args, **kwargs) 
    1813   pre_doc = inner.__doc__ 
    1814   if pre_doc is None: 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_axes.pyc in plot(self, *args, **kwargs) 
    1422    kwargs['color'] = c 
    1423 
-> 1424   for line in self._get_lines(*args, **kwargs): 
    1425    self.add_line(line) 
    1426    lines.append(line) 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_base.pyc in _grab_next_args(self, *args, **kwargs) 
    384     return 
    385    if len(remaining) <= 3: 
--> 386     for seg in self._plot_args(remaining, kwargs): 
    387      yield seg 
    388     return 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_base.pyc in _plot_args(self, tup, kwargs) 
    372   ncx, ncy = x.shape[1], y.shape[1] 
    373   for j in xrange(max(ncx, ncy)): 
--> 374    seg = func(x[:, j % ncx], y[:, j % ncy], kw, kwargs) 
    375    ret.append(seg) 
    376   return ret 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_base.pyc in _makeline(self, x, y, kw, kwargs) 
    278   default_dict = self._getdefaults(None, kw, kwargs) 
    279   self._setdefaults(default_dict, kw, kwargs) 
--> 280   seg = mlines.Line2D(x, y, **kw) 
    281   self.set_lineprops(seg, **kwargs) 
    282   return seg 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\lines.pyc in __init__(self, xdata, ydata, linewidth, linestyle, color, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor, markerfacecoloralt, fillstyle, antialiased, dash_capstyle, solid_capstyle, dash_joinstyle, solid_joinstyle, pickradius, drawstyle, markevery, **kwargs) 
    365   # update kwargs before updating data to give the caller a 
    366   # chance to init axes (and hence unit support) 
--> 367   self.update(kwargs) 
    368   self.pickradius = pickradius 
    369   self.ind_offset = 0 

C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\artist.pyc in update(self, props) 
    854     func = getattr(self, 'set_' + k, None) 
    855     if func is None or not six.callable(func): 
--> 856      raise AttributeError('Unknown property %s' % k) 
    857     func(v) 
    858    changed = True 

AttributeError: Unknown property color_cycle 

Et je suis parti avec un terrain de 4 volet blanc, quand il aurait dû y avoir un seul avec 5 boxplot colonnes: enter image description here

Comment résoudre ce problème?

+0

Fonctionne avec la version '0.19.1' – EdChum

Répondre

1

Je me suis vérifié que l'on a besoin d'avoir pandas 0.19.0-1ensemble avec matplotlib 1.5.1-8 pour ne pas rencontrer cette erreur.