I have a problem in cleaning this dataset:
I would need to plot Text column in this dataset:
Date Account Text
0 [28/07/2018] 412 [MAN]
1 [28/07/2018] 21403 ['photo', 'photo']
2 [28/07/2018] 3193 [Describe, Links']
3 [28/07/2018] 4239 ['photo']
4 [03/08/2018] 051 []
5 [03/08/2018] 21 []
6 [16/08/2018] 4124 ['XCUUE', 'HB']
7 [16/08/2018] 412 [program]
8 [16/08/2018] 410 []
9 [16/08/2018] 9543 [Links]
Specifically, I would need to work on the Text column. The rows within that column are the results of a tokenisation, so they are included in brackets. What I would like to do is to plot those words in a words cloud or a simply bar chart for studying their frequency. The problem that I am having is in the duplicate of the same word, for example 'photo' 'photo' when I try to plot the frequency.
My code is for preparing the dataset for a wordcloud.
comment_words = ''
stopwords = remove_stop() # you can use a default one
for val in df['Text']:
tokens = val.split()
for i in range(len(tokens)):
tokens[i] = tokens[i].str.lower()
comment_words += " ".join(tokens)+" "
wordcloud = WordCloud(width = 800, height = 800,
background_color ='white',
stopwords = stopwords,
min_font_size = 10).generate(comment_words)
I would really appreciate if you could have a look or try a different approach to fix this issues with duplicate words (frequency is important so I cannot drop any duplicate rows) and eventually with quotation mark '. Thank you


