I was trying to plot the two columns with artist name and loudness from a spotify data. but while trying to do the same I am getting error
ValueError: Joey Bada$$ ^ Expected end of text, found '$' (at char 9), (line:1, col:10) while inspecting I found there are data rows with the values like the "Joey Bada$$" in the data rows. Can some one please help me? whether the regex concept can be used in order to avoid this issues. used code is given below;
plt.figure(figsize=(30,10))
plt.scatter(spotifydata['artist_name'],spotifydata['loudness'] )
plt.show()
Matplotlib interprets everything between $ signs as math text. As far as I know this can't be switched off.
If you want to remove the $$ signs:
plt.scatter(spotifydata['artist_name'].str.replace('\$\$',''), spotifydata['loudness'])
if you want to keep the $$ signs:
plt.scatter(spotifydata['artist_name'].str.replace('\$\$','\\$\\$'), spotifydata['loudness'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With