I would like to know how I can remove specific words, including stopwords, from a list of list like this:
my_list=[[],
[],
['A'],
['SB'],
[],
['NMR'],
[],
['ISSN'],
[],
[],
[],
['OF', 'USA'],
[],
['THE'],
['HOME'],
[],
[],
['STAR'],
[]]
If it was a list of strings, I would have applied something like the following:
from collections import Counter
stop_words = stopwords.words('english')
text = ' '.join([word for word in my_list if word not in stop_words])
I would need to plot it at the end doing something like this:
counts= Counter(chain.from_iterable(my_list))
plt.bar(*zip(*counts.most_common(20)))
plt.show()
Expected list to be plotted:
my_list=[[],
[],
['SB'],
[],
['NMR'],
[],
['ISSN'],
[],
[],
[],
['USA'],
[],
['HOME'],
[],
[],
['STAR'],
[]]