1
resposta

O código disponibilizado não roda

O código disponibilizado no curso, não roda. Não consegui descobrir onde está o problema. Poderiam verificar, por favor?

sns.set(style="white")

# Generate a mask for the upper triangle
mask = np.zeros_like(corr, dtype=np.bool)
mask[np.triu_indices_from(mask)] = True

# Set up the matplotlib figure
f, ax = plt.subplots(figsize=(11, 9))

# Generate a custom diverging colormap
cmap = sns.diverging_palette(220, 10, as_cmap=True)

# Draw the heatmap with the mask and correct aspect ratio
sns.heatmap(corr, mask=mask, cmap=cmap, vmax=.3, center=0,
            square=True, linewidths=.5, cbar_kws={"shrink": .5})

TypeError                                 Traceback (most recent call last)


/usr/local/lib/python3.6/dist-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis)
    116     try:
--> 117         num = operator.index(num)
    118     except TypeError:

TypeError: 'float' object cannot be interpreted as an integer


During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)

4 frames

<__array_function__ internals> in linspace(*args, **kwargs)

/usr/local/lib/python3.6/dist-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis)
    119         raise TypeError(
    120             "object of type {} cannot be safely interpreted as an integer."
--> 121                 .format(type(num)))
    122 
    123     if num < 0:

TypeError: object of type <class 'float'> cannot be safely interpreted as an integer.
1 resposta

Olá Henrique.

Baixei a versão dessa aula e consegui rodar.

Estou utilizando o Jupyter Notebook, poderia me informar onde está rodando o código se no Jupyter ou no Colab, dessa maneira conseguimos descobrir exatamente onde está o problema.

Bons Estudos.

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