Usem o "import imageio" no lugar
import matplotlib.pyplot as plt
nome_musica = 'Taylor Swift - Blank Space'
id = projection_kmeans\
.filter(projection_kmeans.artists_song == nome_musica)\
.select('id').collect()[0][0]
track = sp.track(id)
url = track["album"]["images"][1]["url"]
name = track["name"]
image = imageio.imread(url)
plt.imshow(image)
plt.xlabel(name, fontsize = 10)
plt.show()
e
import matplotlib.pyplot as plt
def visualize_songs(name,url):
plt.figure(figsize=(15,10))
columns = 5
for i, u in enumerate(url):
ax = plt.subplot(len(url) // columns + 1, columns, i + 1)
image = imageio.imread(u)
plt.imshow(image)
ax.get_yaxis().set_visible(False)
plt.xticks(color = 'w', fontsize = 0.1)
plt.yticks(color = 'w', fontsize = 0.1)
plt.xlabel(name[i], fontsize = 10)
plt.tight_layout(h_pad=0.7, w_pad=0)
plt.subplots_adjust(wspace=None, hspace=None)
plt.grid(visible=None)
plt.show()