Created
July 7, 2015 02:39
-
-
Save anonymous/970eff6cafb8606fbd4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
outerdic = {} | |
mkfrflist = [] | |
with open('F-F_Research_Data_Factors_daily.txt') as fh: | |
lines = fh.readlines() | |
slicedline = lines[6:-2] | |
header = lines[5].split() | |
for element in slicedline: | |
date = element.split()[0][:6] | |
mkfrflist.append(float(element.split()[1]) | |
outerdic[date] = mkfrflist | |
sorteddic = sorted(outerdic. key=int) | |
sumdic = sum(mkfrflist) | |
keys = outerdic.keys() | |
for key in keys: | |
print key: + 'sum {0}, len {1}, avg {2}'.format(sumdic,len(mkfrflist), sumdic/len(mkfrflist) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment