import mysql.connector as sql import pandas as pd import re import numpy as np from PIL import Image from wordcloud import WordCloud yhendus=sql.connect(host='localhost', database='dh17_laulupidu', user='dh17', password='dh17praktika') df=pd.read_sql(""" SELECT marksona FROM filmide_ajad WHERE marksona IS NOT NULL; """, yhendus) #print(df) marksonad=df.marksona.values.tolist() marksonatekst=" ".join(marksonad) #genereerin marksonapilve mask = np.array(Image.open("noot.jpg")) pilv=WordCloud(background_color="white", collocations=False, mask=mask) pilv=pilv.generate(marksonatekst) pilt=pilv.to_image() pilt.save('/home/annika/public_html/kval_dh/ELU_projekt/lisatud_marksonad.png')