Python Programming approach - data manipulation in excel -
i'm using python packages xlrd , xlwt read , write excel spreadsheets using python. can't figure out how write code solve problem though.
so data consists of column of state abbreviations , column of numbers, 1 through 7. there 200-300 entries per state, , want figure out how many ones, twos, threes, , on exist each state. i'm struggling method i'd use figure out.
normally post code have don't know begin.
- prepare dictionary store results.
- get numbers of line data have using xlrd, iterate on each of them.
- for each state code, if it's not
in
dict, create dict. then check if entry read on second column exists within state key on results dict.
4.1 if not, you'll create dict, , add number found on second column key dict, value of one.
4.2 if does, increment value key (+1).
once has finished looping, result dict have count each individual entry on each individual state.
Comments
Post a Comment