Dec-05-2017, 03:17 PM
Hi, I want to create a word count for an excel file, for cells A2-A77 (the column header A1 is named "A").
I want the cells to be word-counted separately thus I thought of using a while loop and bagsofwords.
This is what I came up with.
Could you help me out? I am a complete novice.
I want the cells to be word-counted separately thus I thought of using a while loop and bagsofwords.
This is what I came up with.
import pandas as pd excel="FILE PATH" df = pd.read_excel(excel) i=0 while i<75: i=i+1 import collections, re bagsofwords = [ collections.Counter(re.findall(r'\w+', df.at[i,'A']))] bagsofwords[:]Clearly, it does not work. It seems to always word-count just the last cell (in this case its A77).
Could you help me out? I am a complete novice.