本文整理汇总了Python中StatValues类的典型用法代码示例。如果您正苦于以下问题:Python StatValues类的具体用法?Python StatValues怎么用?Python StatValues使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StatValues类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeReport
def makeReport(inputFileName, outputDir, projectDir):
print '\n Processing input file ' + inputFileName, 'Time:', time.asctime()
#try :
# For each input file create a separate subfolder for all the related files
[inputId, subFolder] = CheckFolders.MakeSubfolder(inputFileName, outputDir)
# Move the prefilled Tex files into the subfolder
BuildTex.MoveFiles(subFolder, projectDir)
# Parse the input file
[graphData, statData] = ParseInput.dataFromFile(inputFileName, inputId, outputDir, subFolder)
# Compute the statistics values and build the charts
StatValues.computeValues(subFolder, statData)
orgSize = len(statData)
if orgSize < 8 :
print '\nNo graph data!'
BuildTex.SimplifyResult(subFolder)
else :
try :
# Create graphs for the reports
graphObject = BuildGraphs.makeGraphObject(graphData)
BuildGraphs.BuildAllGraphs(inputId, subFolder, graphObject)
except Exception as e:
print e.message
# Create PDF
if orgSize > 37 :
BuildTex.insertTables(subFolder, orgSize)
BuildTex.splitTables(subFolder, orgSize)
BuildTex.CreatePdf(outputDir, subFolder, inputId, inputFileName)
示例2: makeReport
def makeReport(inputFileName, outputDir):
print '\n Processing input file ' + inputFileName
try :
# For each input file create a separate subfolder for all the related files
[inputId, subFolder] = CheckFolders.MakeSubfolder(inputFileName, outputDir)
# Move the prefilled Tex files into the subfolder
BuildTex.MoveFiles(subFolder)
# Parse the input file
[graphData, statData] = ParseInput.dataFromFile(inputFileName, inputId, outputDir, subFolder)
# Compute the values
StatValues.computeValues(subFolder, statData)
# Process the input data to create charts, graphs, Tex and then PDF
# Create graphs for the reports
graphObject = BuildGraphs.makeGraphObject(graphData)
BuildGraphs.BuildAllGraphs(inputId, subFolder, graphObject)
# Create charts and histograms for the reports
BuildCharts.BuildAllCharts(subFolder, statData)
# Create PDF
BuildTex.CreatePdf(outputDir, subFolder, inputId, inputFileName)
except Exception as e:
print e.message
print 'Creating PDF failed for ', inputId
print '\n', '*'*70, '\n', '-'*70, '\n'
示例3: compute21a
def compute21a(subFolder, statData): # aggregate
print '\nComputing values for slide 2.1.1.'
values = ParseInput.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])
BuildTexts.addMacro(subFolder, 'valBAAyesNumP', str(yesNumP))
BuildTexts.addMacro(subFolder, 'valBAAnoNumP', str(noNumP))
BuildCharts.YesNoPieSVG(subFolder, 'pie211.svg', yesNumP, noNumP)
示例4: compute22a
def compute22a(subFolder, statData): # aggregate
print '\nComputing values for slide 2.2.1.'
values = ParseInput.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])
BuildTexts.addMacro(subFolder, 'valBBAyesNumP', str(yesNumP))
BuildTexts.addMacro(subFolder, 'valBBAnoNumP', str(noNumP))
BuildCharts.YesNoPieSVG(subFolder, 'pie221.svg', yesNumP, noNumP)
示例5: compute23d
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)
示例6: compute23b
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)
示例7: compute23a
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)
示例8: compute42c
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)
示例9: compute31a
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
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: compute32a
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)
示例12: compute71
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)
示例13: extractGraphDataBlock
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 ]
示例14: computeParticipatedManWomen
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))
示例15: compute23c
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])