3
respostas

erro ao usar relplot no jupiter

usei esse comando: porcentagem_conta_linha = sns.relplot(x='valor_da_conta', y='porcentagem', data=gorjetas) e deu esse erro: C:\Users\PMT\anaconda3\Lib\site-packages\seaborn\axisgrid.py:257: FutureWarning: In the future np.bool will be defined as the corresponding NumPy scalar. none_na = np.zeros(len(data), np.bool)

AttributeError Traceback (most recent call last) Cell In[105], line 1 ----> 1 porcentagem_conta_linha = sns.relplot(x='valor_da_conta', y='porcentagem', data=gorjetas)

File ~\anaconda3\Lib\site-packages\seaborn\relational.py:1603, in relplot(x, y, hue, size, style, data, row, col, col_wrap, row_order, col_order, palette, hue_order, hue_norm, sizes, size_order, size_norm, markers, dashes, style_order, legend, kind, height, aspect, facet_kws, **kwargs) 1601 # Set up the FacetGrid object 1602 facet_kws = {} if facet_kws is None else facet_kws -> 1603 g = FacetGrid( 1604 data=data, row=row, col=col, col_wrap=col_wrap, 1605 row_order=row_order, col_order=col_order, 1606 height=height, aspect=aspect, dropna=False, 1607 **facet_kws 1608 ) 1610 # Draw the plot 1611 g.map_dataframe(func, x, y, 1612 hue=hue, size=size, style=style, 1613 **plot_kws)

File ~\anaconda3\Lib\site-packages\seaborn\axisgrid.py:257, in FacetGrid.init(self, data, row, col, hue, col_wrap, sharex, sharey, height, aspect, palette, row_order, col_order, hue_order, hue_kws, dropna, legend_out, despine, margin_titles, xlim, ylim, subplot_kws, gridspec_kws, size) 253 hue_kws = hue_kws if hue_kws is not None else {} 255 # Make a boolean mask that is True anywhere there is an NA 256 # value in one of the faceting variables, but only if dropna is True --> 257 none_na = np.zeros(len(data), np.bool) 258 if dropna: 259 row_na = none_na if row is None else data[row].isnull()

File ~\anaconda3\Lib\site-packages\numpy_init_.py:305, in getattr(attr) 300 warnings.warn( 301 f"In the future np.{attr} will be defined as the " 302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2) 304 if attr in former_attrs: --> 305 raise AttributeError(former_attrs[attr]) 307 # Importing Tester requires importing all of UnitTest which is not a 308 # cheap import Since it is mainly used in test suits, we lazy import it 309 # here to save on the order of 10 ms of import time for most users 310 # 311 # The previous way Tester was imported also had a side effect of adding 312 # the full numpy.testing namespace 313 if attr == 'testing':

AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

​Alguém sabe o que devo fazer?

3 respostas

E aí, Marco Aurelio! O problema tá no np.bool que foi deprecado.

O erro tá dizendo que o numpy não tá mais reconhecendo np.bool. A dica aqui é trocar isso pelo bom e velho bool.

Então, o que você pode fazer é o seguinte: procura essa parte do código onde tá np.bool e muda só pra bool. Isso vai resolver o problema do deprecation.

É bem isso aí. Faz essa mudança e tenta rodar de novo pra ver se resolve o pepino.

Bom dia! Vou tentar isso aí e depois digo se funcionou... Muito obrigado...

Deu certo! Valeu...