本文整理汇总了Python中StatValues.extractAnswers方法的典型用法代码示例。如果您正苦于以下问题:Python StatValues.extractAnswers方法的具体用法?Python StatValues.extractAnswers怎么用?Python StatValues.extractAnswers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StatValues
的用法示例。
在下文中一共展示了StatValues.extractAnswers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: extractGraphDataBlock
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def extractGraphDataBlock(dataline, localId) :
id = StatValues.extractAnswers([dataline], [5])[0]
name = StatValues.extractAnswers([dataline], [6])[0]
position = StatValues.extractAnswers([dataline], [7])[0]
year = StatValues.extractAnswers([dataline], [14])[0]
if len(year) == 4 :
age = 2014 - int(year)
else :
age = 0
print 'Age is unknown for', id, name
edgeGroups = extractEdgeGroups(dataline)
return [ id, str(localId), name + position, age, edgeGroups ]
示例2: computeParticipatedManWomen
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def computeParticipatedManWomen(subFolder, statData) :
values = StatValues.extractAnswers(statData, [9])
men = values.count('14')
women = values.count('15')
BuildTex.addMacros(subFolder, 'nParticipated', str(men+women))
BuildTex.addMacros(subFolder, 'numMen', str(men))
BuildTex.addMacros(subFolder, 'numWomen', str(women))
示例3: computeAllBossTeacher
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def computeAllBossTeacher(subFolder, statData) :
values = StatValues.extractAnswers(statData, [8])
boss = values.count('201') + values.count('202')
teacher = values.count('203')
BuildTex.addMacros(subFolder, 'nTotal', str(len(statData)))
BuildTex.addMacros(subFolder, 'numBoss', str(boss))
BuildTex.addMacros(subFolder, 'numTeacher', str(teacher))
示例4: computeTeachCat
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def computeTeachCat(subFolder, statData) :
values = StatValues.extractAnswers(statData, [19])
keys = [str(i+55) for i in range(5)]
stat = [values.count(key) for key in keys]
print '\nTeacher categories:', values, stat
BuildTex.addMacros(subFolder, 'numTechCatA', str(stat[0]))
BuildTex.addMacros(subFolder, 'numTechCatB', str(stat[1]))
BuildTex.addMacros(subFolder, 'numTechCatC', str(stat[2]))
BuildTex.addMacros(subFolder, 'numTechCatD', str(stat[3]))
BuildTex.addMacros(subFolder, 'numTechCatE', str(stat[4]))
示例5: compute42c
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def compute42c(subFolder, statData): # one question
print '\nComputing values for slide 4.2.c.'
values = StatValues.extractAnswers(statData, [54])
yesNum = values.count('87') + values.count('88')
noNum = values.count('89') + values.count('90')
[yesNumP, noNumP] = StatValues.percent([yesNum,noNum])
BuildTex.addMacros(subFolder, 'valDBCyesNum', str(yesNum))
BuildTex.addMacros(subFolder, 'valDBCnoNum', str(noNum))
BuildTex.addMacros(subFolder, 'valDBCyesNumP', str(yesNumP))
BuildTex.addMacros(subFolder, 'valDBCnoNumP', str(noNumP))
BuildCharts.YesNoPie(subFolder + '\\pie42_c_.png', yesNumP, noNumP)
示例6: compute23a
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def compute23a(subFolder, statData): # aggregate
print '\nComputing values for slide 2.3.1.'
values = StatValues.extractAnswers(statData, [23])
yesNum = values.count('61')
noNum = values.count('62')
[yesNumP, noNumP] = StatValues.percent([yesNum,noNum])
BuildTex.addMacros(subFolder, 'valBCAyesNum', str(yesNum))
BuildTex.addMacros(subFolder, 'valBCAnoNum', str(noNum))
BuildTex.addMacros(subFolder, 'valBCAyesNumP', str(yesNumP))
BuildTex.addMacros(subFolder, 'valBCAnoNumP', str(noNumP))
BuildCharts.YesNoPie(subFolder + '\\pie231.png', yesNumP, noNumP)
示例7: compute23d
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def compute23d(subFolder, statData): # aggregate
print '\nComputing values for slide 2.3.4.'
values = StatValues.extractAnswers(statData, [30])
yesNum = values.count('83') + values.count('84')
noNum = values.count('85') + values.count('86')
[yesNumP, noNumP] = StatValues.percent([yesNum,noNum])
BuildTex.addMacros(subFolder, 'valBCDyesNum', str(yesNum))
BuildTex.addMacros(subFolder, 'valBCDnoNum', str(noNum))
BuildTex.addMacros(subFolder, 'valBCDyesNumP', str(yesNumP))
BuildTex.addMacros(subFolder, 'valBCDnoNumP', str(noNumP))
BuildCharts.YesNoPie(subFolder + '\\pie234.png', yesNumP, noNumP)
示例8: compute23b
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def compute23b(subFolder, statData): # aggregate
print '\nComputing values for slide 2.3.2.'
values = StatValues.extractAnswers(statData, [52])
yesNum = values.count('99') + values.count('100')
noNum = values.count('101') + values.count('102')
[yesNumP, noNumP] = StatValues.percent([yesNum,noNum])
BuildTex.addMacros(subFolder, 'valBCByesNum', str(yesNum))
BuildTex.addMacros(subFolder, 'valBCBnoNum', str(noNum))
BuildTex.addMacros(subFolder, 'valBCByesNumP', str(yesNumP))
BuildTex.addMacros(subFolder, 'valBCBnoNumP', str(noNumP))
BuildCharts.YesNoPie(subFolder + '\\pie232.png', yesNumP, noNumP)
示例9: compute31a
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def compute31a(subFolder, statData): # aggregate
print '\nComputing values for slide 3.1.1.'
values = StatValues.extractAnswers(statData, [43])
yesNum = values.count('103') + values.count('104')
noNum = values.count('105') + values.count('106')
[yesNumP, noNumP] = StatValues.percent([yesNum,noNum])
BuildTex.addMacros(subFolder, 'valCAAyesNum', str(yesNum))
BuildTex.addMacros(subFolder, 'valCAAnoNum', str(noNum))
BuildTex.addMacros(subFolder, 'valCAAyesNumP', str(yesNumP))
BuildTex.addMacros(subFolder, 'valCAAnoNumP', str(noNumP))
BuildCharts.YesNoPie(subFolder + '\\pie311.png', yesNum, noNum)
示例10: compute74
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def compute74(subFolder, statData): # by question
print "\nComputing values for slide 7.4."
values = StatValues.extractAnswers(statData, [56, 57])
values = StatValues.joinListsByQuestion(values)
yesNum = [val.count("87") + val.count("88") for val in values]
noNum = [val.count("89") + val.count("90") for val in values]
BuildTex.addMacros(subFolder, "valGDyesNumA", str(yesNum[0]))
BuildTex.addMacros(subFolder, "valGDyesNumB", str(yesNum[1]))
BuildTex.addMacros(subFolder, "valGDnoNumA", str(noNum[0]))
BuildTex.addMacros(subFolder, "valGDnoNumB", str(noNum[1]))
BuildCharts.YesNoPie(subFolder + "\\pie74a.png", yesNum[0], noNum[0])
BuildCharts.YesNoPie(subFolder + "\\pie74b.png", yesNum[1], noNum[1])
示例11: compute22a
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def compute22a(subFolder, statData): # aggregate
print '\nComputing values for slide 2.2.1.'
values = StatValues.extractAnswers(statData, [28,29,46,47])
values = StatValues.joinLists(values)
yesNum = values.count('83') + values.count('84')
noNum = values.count('85') + values.count('86')
[yesNumP, noNumP] = StatValues.percent([yesNum,noNum])
BuildTex.addMacros(subFolder, 'valBBAyesNum', str(yesNum))
BuildTex.addMacros(subFolder, 'valBBAnoNum', str(noNum))
BuildTex.addMacros(subFolder, 'valBBAyesNumP', str(yesNumP))
BuildTex.addMacros(subFolder, 'valBBAnoNumP', str(noNumP))
BuildCharts.YesNoPie(subFolder + '\\pie221.png', yesNum, noNum)
示例12: compute21a
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def compute21a(subFolder, statData): # aggregate
print '\nComputing values for slide 2.1.1.'
values = StatValues.extractAnswers(statData, [38,39])
values = StatValues.joinLists(values)
yesNum = values.count('87') + values.count('88')
noNum = values.count('89') + values.count('90')
[yesNumP, noNumP] = StatValues.percent([yesNum,noNum])
BuildTex.addMacros(subFolder, 'valBAAyesNum', str(yesNum))
BuildTex.addMacros(subFolder, 'valBAAnoNum', str(noNum))
BuildTex.addMacros(subFolder, 'valBAAyesNumP', str(yesNumP))
BuildTex.addMacros(subFolder, 'valBAAnoNumP', str(noNumP))
BuildCharts.YesNoPie(subFolder + '\\pie211.png', yesNum, noNum)
示例13: compute71
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def compute71(subFolder, statData): # aggregate
print "\nComputing values for slide 7.1."
values = StatValues.extractAnswers(statData, [56, 57])
values = StatValues.joinLists(values)
yesNum = values.count("87") + values.count("88")
noNum = values.count("89") + values.count("90")
[yesNumP, noNumP] = StatValues.percent([yesNum, noNum])
BuildTex.addMacros(subFolder, "valGAyesNum", str(yesNum))
BuildTex.addMacros(subFolder, "valGAnoNum", str(noNum))
BuildTex.addMacros(subFolder, "valGAyesNumP", str(yesNumP))
BuildTex.addMacros(subFolder, "valGAnoNumP", str(noNumP))
BuildCharts.YesNoPie(subFolder + "\\pie71.png", yesNumP, noNumP)
示例14: compute32a
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def compute32a(subFolder, statData): # aggregate
print '\nComputing values for slide 3.2.1.'
values = StatValues.extractAnswers(statData, [40,41,42])
values = StatValues.joinLists(values)
yesNum = values.count('99') + values.count('100')
noNum = values.count('101') + values.count('102')
[yesNumP, noNumP] = StatValues.percent([yesNum,noNum])
BuildTex.addMacros(subFolder, 'valCBAyesNum', str(yesNum))
BuildTex.addMacros(subFolder, 'valCBAnoNum', str(noNum))
BuildTex.addMacros(subFolder, 'valCBAyesNumP', str(yesNumP))
BuildTex.addMacros(subFolder, 'valCBAnoNumP', str(noNumP))
BuildCharts.YesNoPie(subFolder + '\\pie321.png', yesNum, noNum)
示例15: compute23c
# 需要导入模块: import StatValues [as 别名]
# 或者: from StatValues import extractAnswers [as 别名]
def compute23c(subFolder, statData): # aggregate (1 question)
print '\nComputing values for slide 2.3.3.'
values = StatValues.extractAnswers(statData, [53])
ansA = values.count('120')
ansB = values.count('121')
ansC = values.count('122')
[ansAp, ansBp, ansCp] = StatValues.percent([ansA, ansB, ansC])
BuildTex.addMacros(subFolder, 'valBCCansA', str(ansA))
BuildTex.addMacros(subFolder, 'valBCCansB', str(ansB))
BuildTex.addMacros(subFolder, 'valBCCansC', str(ansC))
BuildTex.addMacros(subFolder, 'valBCCansAp', str(ansAp))
BuildTex.addMacros(subFolder, 'valBCCansBp', str(ansBp))
BuildTex.addMacros(subFolder, 'valBCCansCp', str(ansCp))
BuildCharts.Pie(subFolder + '\\pie233.png', [ansAp, ansBp, ansCp])