Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro ao construir gráfico com matplotlib

Oi, pessoal! Estou tendo um problema ao aplicar o código

grupo_bairros['Valor'].std().plot.bar(color = 'blue')

Achei que pudesse ter a ver com a instalação do matplotlib, então coloquei no prompt os seguintes comandos:

conda install -c conda-forge matplotlib
conda install notebook ipykernel
ipython kernel install --user

Mas ainda assim o erro persiste. Segue o erro completo:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-75-94eff7d9d3dc> in <module>
----> 1 grupo_bairros['Valor'].std().plot.bar(color = 'blue')

~\Anaconda3\envs\alura_pandas\lib\site-packages\pandas\plotting\_core.py in bar(self, **kwds)
   2536         axes : matplotlib.AxesSubplot or np.array of them
   2537         """
-> 2538         return self(kind='bar', **kwds)
   2539 
   2540     def barh(self, **kwds):

~\Anaconda3\envs\alura_pandas\lib\site-packages\pandas\plotting\_core.py in __call__(self, kind, ax, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, label, secondary_y, **kwds)
   2501                            colormap=colormap, table=table, yerr=yerr,
   2502                            xerr=xerr, label=label, secondary_y=secondary_y,
-> 2503                            **kwds)
   2504     __call__.__doc__ = plot_series.__doc__
   2505 

~\Anaconda3\envs\alura_pandas\lib\site-packages\pandas\plotting\_core.py in plot_series(data, kind, ax, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, label, secondary_y, **kwds)
   1925                  yerr=yerr, xerr=xerr,
   1926                  label=label, secondary_y=secondary_y,
-> 1927                  **kwds)
   1928 
   1929 

~\Anaconda3\envs\alura_pandas\lib\site-packages\pandas\plotting\_core.py in _plot(data, x, y, subplots, ax, kind, **kwds)
   1725                             pass
   1726                 data = series
-> 1727         plot_obj = klass(data, subplots=subplots, ax=ax, kind=kind, **kwds)
   1728 
   1729     plot_obj.generate()

~\Anaconda3\envs\alura_pandas\lib\site-packages\pandas\plotting\_core.py in __init__(self, data, **kwargs)
   1172 
   1173         self.log = kwargs.pop('log', False)
-> 1174         MPLPlot.__init__(self, data, **kwargs)
   1175 
   1176         if self.stacked or self.subplots:

~\Anaconda3\envs\alura_pandas\lib\site-packages\pandas\plotting\_core.py in __init__(self, data, kind, by, subplots, sharex, sharey, use_index, figsize, grid, legend, rot, ax, fig, title, xlim, ylim, xticks, yticks, sort_columns, fontsize, secondary_y, colormap, table, layout, **kwds)
     98                  table=False, layout=None, **kwds):
     99 
--> 100         _converter._WARN = False
    101         self.data = data
    102         self.by = by

NameError: name '_converter' is not defined
1 resposta
solução!

Consegui resolver hehe Precisava dar um restart and run all no código pra ele puxar as importações. Ops.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software