def dictAvg(listOfDicts,key,stdErr=False):
vals=dictVals(listOfDicts,key)<EOL>if len(vals) and np.any(vals):<EOL><INDENT>av=np.nanmean(vals)<EOL>er=np.nanstd(vals)<EOL>if stdErr:<EOL><INDENT>er=er/np.sqrt(np.count_nonzero(~np.isnan(er)))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>av,er=np.nan,np.nan<EOL><DEDENT>return av,er<EOL>
Given a list (l) of dicts (d), return AV and SD.