Como corrigir isto?
O código foi baixado do próprio curso e estou utilizando o mesmo ambiente do curso que é o Google Colab...
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.
Célula do Google Colab contendo o código com erro:
from string import ascii_letters
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
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})
Instalei o Seaborn, mas mesmo assim o erro permanece:
!pip install seaborn