I am trying to create a polars dataframe which is a frequency table of words in a list of words. Something like this:
from collections import defaultdict
word_freq= defaultdict(int)
for word in list_of_words:
word_freq[word] += 1
Except, instead of a dictionary I would like it to be a polars dataframe with two columns: word, count.
I would also like to know what the best way to convert this dict to a df (in cases where that may be needed).