-
Notifications
You must be signed in to change notification settings - Fork 28
Description
#Set and compute the Correlation Matrix:
sns.set(style="white")
corr = data2.corr()
#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 and a diverging colormap:
f, ax = plt.subplots(figsize=(18, 15))
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,annot = True, linewidths=.5, cbar_kws={"shrink": .5})
AttributeError Traceback (most recent call last)
Cell In[43], line 7
3 corr = data2.corr()
5 #Generate a mask for the upper triangle:
----> 7 mask = np.zeros_like(corr, dtype=np.bool)
8 mask[np.triu_indices_from(mask)] = True
10 #Set up the matplotlib figure and a diverging colormap:
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 @Pradnya1208