I have
import pandas as pd
from nltk import FreqDist as fd
# frankenstein freqdist
frank_fd = fd('frank_lemma')
for word, count in frank_fd.items():
data = {'Word':[word], 'Counts':[count]}
df = pd.DataFrame(data)
df.head()
but my printout gives me only one word with one count. I tried putting print(word, count) in the first line of the for loop and it is going over every word, just not adding them all to the df I tried to create. Anyone know why?
Edit: I checked out my data and it is only adding the very last word to the df