• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python statistics.Statistics类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中statistics.Statistics的典型用法代码示例。如果您正苦于以下问题:Python Statistics类的具体用法?Python Statistics怎么用?Python Statistics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Statistics类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: statistic_page

def statistic_page():
    stats = Statistics(app.config['dsn'])
    aths = Athletes(app.config['dsn'])
    if request.method == 'GET':
        now = datetime.datetime.now()
        statlist = stats.get_statisticlist()
        athlist = aths.get_athletlist()
        return render_template('statistics.html', StatisticList = statlist,AthletList = athlist, current_time=now.ctime())
    elif 'statistics_to_delete' in request.form:
        id_statistics = request.form.getlist('statistics_to_delete')
        for id_statistic in id_statistics:
            stats.delete_statistic(id_statistic)
        return redirect(url_for('statistic_page'))
    elif 'statistics_to_add' in request.form:
        id_athletes = request.form.getlist('statistics_to_add')
        for id_athlete in id_athletes:
            stats.add_statistic(request.form['distance'], request.form['time'],id_athlete)
        return redirect(url_for('statistic_page'))
    elif 'statistics_to_update' in request.form:
        stats.update_statistic(request.form['distance'], request.form['time'],request.form['id_statistic'])
        return redirect(url_for('statistic_page'))
    elif 'statistics_to_search' in request.form:
            searchList = stats.search_statistic(request.form['name']);
            now = datetime.datetime.now()
            statlist = stats.get_statisticlist()
            athlist = aths.get_athletlist()
            return render_template('statistics.html', StatisticList = statlist, SearchList = searchList,AthletList = athlist, current_time=now.ctime())
开发者ID:itucsdb1501,项目名称:itucsdb1501,代码行数:27,代码来源:server.py


示例2: get

 def get(self):
     ip = self.request.remote_addr
     uid = 'notfound'
     url = self.request.uri
     user_agent = self.request.headers.get('User-Agent','none')
     new = Statistics(uid=uid,url=url,user_agent = user_agent, ip=ip,mtime=datetime.datetime.utcnow())
     new.put()
     self.redirect('https://www.google.com')
开发者ID:wujianguo,项目名称:wjgstatistics,代码行数:8,代码来源:notfound.py


示例3: do_stats

 def do_stats(self, fp, records):
     stats = Statistics([StatisticsAuthorNameColumn('Name', lambda x : x.author)])
     stats.process_records(records.comments, [
         StatisticsCountColumn('Comments', lambda x : x.timestamp)
         ])
     stats.process_records(records.technical_comments, [
         StatisticsCountColumn('Technical', lambda x : x.timestamp)
         ])
     stats.process_records(records.votes, [
         StatisticsCountColumn('Votes', lambda x : x.timestamp)
         ])
     stats.print_stats(fp, sort_by='Comments')
开发者ID:teemumurtola,项目名称:gerrit-scripts,代码行数:12,代码来源:gerrit-stats.py


示例4: __init__

 def __init__(self, dbName1, dbName2, rootDir=None):
     Statistics.__init__(self, dbName1, dbName2, rootDir)
     self.total = self.table1.count()
     self.rootDir = os.path.join(self.rootDir, u"步骤三数据库数据的匹配程度")
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, r"3.数据库1、2与数据库3的比对")    
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, r"2.数据库2与数据库3对比")    
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
         
     self.logger = logging.getLogger('CompareDB2AndDB3')
开发者ID:wangyangkobe,项目名称:history,代码行数:16,代码来源:threeDatabases.py


示例5: __init__

 def __init__(self, dbName1, dbName2, rootDir = None):
     Statistics.__init__(self, dbName1, dbName2, rootDir)
     self.total = self.table1.count()
     self.rootDir = os.path.join(self.rootDir, u"步骤三数据库数据的匹配程度")
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, u"2.不考虑公历年")    
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, u"1.不考虑季节")    
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
             
     self.logger = logging.getLogger(u'不考虑季')
开发者ID:wangyangkobe,项目名称:history,代码行数:16,代码来源:noCareJi.py


示例6: step3

 def step3(self):
     resultDir = self.createDir(str(3))
     (match, no_match) = self.createResultFile(resultDir)
 
     success = 0
     failed  = 0    
     for element in self.table1.find({'ji': {'$ne': ""}}):
         ji = element['ji']
         gongLiNian = int(element['gongLiNian'])
         gongLiNianScope = [str(gongLiNian-1), str(gongLiNian), str(gongLiNian+1)]
         res = self.table2.find_one({'guanZhi' : element['guanZhi'], 
                                      'gongLiNian' : {'$in': gongLiNianScope},
                                     'name'    : element['name'],
                                     'minZu'   : element['minZu']})
     
         if res and (len(ji) > 0) and (Statistics.convertJi(self, res['ji']) in self.jiScope(ji)) and (element['qiFen'] == res['qiFen'] or element['qiFen'] == res['qiFenHuo']):
             match.write(self.formatElement(element))
             success += 1
         else:
             no_match.write(self.formatElement(element))
             failed += 1
     failed = self.total - success
     result = (success, success/self.total, failed, failed/self.total)    
     self.logResult(3, result) 
     return result
开发者ID:wangyangkobe,项目名称:history,代码行数:25,代码来源:twoJi.py


示例7: getter

 def getter(self):
     ans = Statistics.by_id(self.data['statistics_id'])
     if ans is None:
         ans = Statistics()
         self.data['statistics_id'] = ans._id
         return ans, True
     return ans
开发者ID:Earthson,项目名称:afewords_base,代码行数:7,代码来源:catalog.py


示例8: main

def main():
    config = Configuration()
    config.load("config/config.json")

    emailFiles = listEmailFiles(config.gmailRoot)
    stats = Statistics()

    progress = ProgressBar(
        widgets=["Parsing Mail: ", Percentage(), " ", Bar(), " ", ETA()], maxval=len(emailFiles)
    ).start()

    for filename in emailFiles:
        progress.update(progress.currval + 1)
        updateStatistics(stats, config, filename)

    progress.finish()

    stats.save()
开发者ID:hortont424,项目名称:email-stats,代码行数:18,代码来源:main.py


示例9: get

    def get(self):
        sta = Statistics.all()
#        sta.order("-mtime")
        for s in sta:
            if not s.addr:
                s.addr = addr.ip2addr(s.ip)
                s.put()
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('ok')
开发者ID:wujianguo,项目名称:wjgstatistics,代码行数:9,代码来源:ip2addr.py


示例10: create_banks

    def create_banks(self):
        """
        Creates bank objects, stores them in self.banks, and registers them in a self.bank_to_id.
        A part of all banks follows a Pareto distribution, all others a log-normal distribution, in asset size.
        All created banks are registered in the dictionary self.id_to_bank.
        :rtype : None
        """
        for n in xrange(0, NUMBER_OF_BANKS_LOGNORMAL):
            bank_size = Statistics.generate_lognormal_number(LOGNORMAL_MEAN, LOGNOMRAL_STDEV)
            bank = Bank(bank_size)
            self.banks.append(bank)
            self.id_to_bank[id(bank)] = bank

        for n in xrange(0, NUMBER_OF_BANKS_PARETO):
            bank_size = Statistics.generate_pareto_number(PARETO_SCALE, PARETO_SHAPE)
            bank = Bank(bank_size)
            self.banks.append(bank)
            self.id_to_bank[id(bank)] = bank
开发者ID:1Reinier,项目名称:CapstoneThesis,代码行数:18,代码来源:controller.py


示例11: get

 def get(self):
     ip = self.request.remote_addr
     user_agent = self.request.headers.get('User-Agent','none')
     try:
         url = self.request.query_string
         logging.info(url)
         uid, url = url.split('&', 1)
     except Exception as e:
         logging.error(e)
         uid = 'err'
         new = Statistics(uid=uid,url=url,user_agent = user_agent, ip=ip,mtime=datetime.datetime.utcnow())
         url = 'https://www.google.com'
     else:
         new = Statistics(uid=uid,url=url,user_agent = user_agent, ip=ip,mtime=datetime.datetime.utcnow())
     new.put()
     if not url.startswith('http'):
         url = 'http://' + url
     self.redirect(str(url))
开发者ID:wujianguo,项目名称:wjgstatistics,代码行数:18,代码来源:index.py


示例12: __init__

    def __init__(self, genome):

        """ The GPopulation Class creator """

        if isinstance(genome, GPopulation):

            self.oneSelfGenome = genome.oneSelfGenome
            self.internalPop = []
            self.internalPopRaw = []
            self.popSize = genome.popSize
            self.sortType = genome.sortType
            self.sorted = False
            self.minimax = genome.minimax
            self.scaleMethod = genome.scaleMethod
            self.allSlots = [self.scaleMethod]

            self.internalParams = genome.internalParams
            self.multiProcessing = genome.multiProcessing

            self.statted = False
            self.stats = Statistics()
            return

        log.debug("New population instance, %s class genomes.", genome.__class__.__name__)

        self.oneSelfGenome = genome
        self.internalPop = []
        self.internalPopRaw = []
        self.popSize = 0
        self.sortType = constants.CDefPopSortType
        self.sorted = False
        self.minimax = constants.CDefPopMinimax
        self.scaleMethod = FunctionSlot("Scale Method")
        self.scaleMethod.set(constants.CDefPopScale)
        self.allSlots = [self.scaleMethod]

        self.internalParams = {}
        self.multiProcessing = (False, False, None)

        # Statistics
        self.statted = False
        self.stats = Statistics()
开发者ID:Stargrazer82301,项目名称:CAAPR,代码行数:42,代码来源:population.py


示例13: __init__

    def __init__(self, dbName1, dbName2, rootDir = None):
        Statistics.__init__(self, dbName1, dbName2, rootDir)
        self.total = Statistics.numberOfGongLiNianEqual(self)
        self.rootDir = os.path.join(self.rootDir, u"步骤三数据库数据的匹配程度")
        if not os.path.exists(self.rootDir):
            os.mkdir(self.rootDir)
        
        self.rootDir = os.path.join(self.rootDir, u"2.不考虑公历年")    
        if not os.path.exists(self.rootDir):
            os.mkdir(self.rootDir)
        
        self.rootDir = os.path.join(self.rootDir, u"2.考虑季节")    
        if not os.path.exists(self.rootDir):
            os.mkdir(self.rootDir)
        
        self.rootDir = os.path.join(self.rootDir, u"ͬ3.连续2季")
        if not os.path.exists(self.rootDir):
            os.mkdir(self.rootDir)  

        self.logger = logging.getLogger('TwoJi')
开发者ID:wangyangkobe,项目名称:history,代码行数:20,代码来源:twoJi.py


示例14: __init__

 def __init__(self, root):
     self.root = root
     self.root.title("Minesweeper")
     self.frame = Frame(root)
     self.frame.grid()
     self.size = (9,) * 2
     self.num_mines = 10
     self.stats = Statistics()
     self.buttons = {}
     self.add_menu_bar()
     self.add_header()
     self.new_game()
开发者ID:tjtrebat,项目名称:minesweeper,代码行数:12,代码来源:minesweeper.py


示例15: __init__

 def __init__(self, dbName1, dbName2, rootDir = None):
     Statistics.__init__(self, dbName1, dbName2, rootDir)
     #self.total = self.table1.find({'ji': {'$ne': ""}}).count()
     self.total = Statistics.numberOfGongLiNianEqual(self)
     self.rootDir = os.path.join(self.rootDir, u"步骤三数据库数据的匹配程度")
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, u"2.不考虑公历年")    
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, u"2.考虑季节")    
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, u"ͬ4.连续3季")
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)  
         
     self.logger = logging.getLogger('ThreeJi')
开发者ID:wangyangkobe,项目名称:history,代码行数:21,代码来源:threeJi_.py


示例16: __init__

 def __init__(self, dbName1, dbName2, rootDir=None):
     Statistics.__init__(self, dbName1, dbName2, rootDir)
     self.total = self.table1.count()
     
     self.rootDir = os.path.join(self.rootDir, u"步骤三数据库数据的匹配程度")
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, r"3.数据库1、2与数据库3的比对")    
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, r"2.数据库2与数据库3对比")    
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
         
     self.logger = logging.getLogger('CompareDB2AndDB3')
     
     self.condition10to30 = self.extractData(-10, 30)
     self.condition20to40 = self.extractData(-20, 40)
     self.condition30to50 = self.extractData(-30, 50)
开发者ID:wangyangkobe,项目名称:history,代码行数:21,代码来源:compare2And3.py


示例17: __init__

 def __init__(self, dbName1, dbName2, rootDir = None):
     Statistics.__init__(self, dbName1, dbName2, rootDir)
     self.total = self.table1.find({'ji': {'$ne': ""}}).count()
     #self.total = Statistics.numberOfGongLiNianEqual(self)
     self.rootDir = os.path.join(self.rootDir, u"步骤三数据库数据的匹配程度")
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, u"2.不考虑公历年")    
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, u"3.考虑公历年")    
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)
     
     self.rootDir = os.path.join(self.rootDir, u"4.连续4年+3") 
     if not os.path.exists(self.rootDir):
         os.mkdir(self.rootDir)    
         
     self.logger = logging.getLogger('TwoYear')
     self.logger.info("totol record: {}".format(self.total))
开发者ID:wangyangkobe,项目名称:history,代码行数:22,代码来源:fourYear.py


示例18: __init__

    def __init__(self, dbName1, dbName2, year, rootDir = None):
        Statistics.__init__(self, dbName1, dbName2, rootDir)
        self.total = self.table1.find({'ji': {'$ne': ""}}).count()
        
        rootDir = os.path.join(os.path.dirname(__file__), u"数据库1_1")

        if not os.path.exists(rootDir):
            os.mkdir(rootDir)    
        if year < 0:
            rootDir = os.path.join(rootDir, "提前{}year".format(abs(year)))
        elif year > 0:
            rootDir = os.path.join(rootDir, "延后{}year".format(abs(year)))
        else:
            rootDir = os.path.join(rootDir, "同一年year")
        if not os.path.exists(rootDir):
            os.mkdir(rootDir)    
        self.rootDir = rootDir
        
        self.year = year
            
        self.logger = logging.getLogger('Statistics1_1')
        self.logger.info("totol record: {}".format(self.total))
开发者ID:wangyangkobe,项目名称:history,代码行数:22,代码来源:database1_1.py


示例19: allocate_degrees

 def allocate_degrees(self):
     """
     First sort banks by asset size, then match them with sorted degree list.
     Node degrees are governed by a power law.
     :rtype : None
     """
     self.banks.sort(key=lambda _bank: _bank.balance.assets)
     degrees = [math.floor(Statistics.draw_from_powerlaw(POWERLAW_EXPONENT_OUT_DEGREE, 1.0) + 0.6748)
                for degree in xrange(0, len(self.banks))]
     for i in xrange(0, len(degrees)):
         if degrees[i] > MAX_K_OUT:
             degrees[i] = MAX_K_OUT
     degrees.sort()
     for n in xrange(0, len(self.banks)):
         self.banks[n].out_degree = degrees[n]
开发者ID:1Reinier,项目名称:CapstoneThesis,代码行数:15,代码来源:controller.py


示例20: __init__

	def __init__(self):

		font = sf.Font.from_file("media/fonts/UbuntuMono-R.ttf")
		self.statistics = Statistics(font)

		window_settings = sf.window.ContextSettings()
		window_settings.antialiasing_level = 8
		self.window = sf.RenderWindow(
			sf.VideoMode(width, height),
			"Steering Behaviors For Autonomous Characters",
			sf.Style.DEFAULT, window_settings)
		self.window.vertical_synchronization = False

		self.entities = []
		self.grid = CollisionGrid(width, height, cell_size)
		self.collision = 0
开发者ID:warbaque,项目名称:python-steering-behaviors,代码行数:16,代码来源:application.py



注:本文中的statistics.Statistics类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python statprof.start函数代码示例发布时间:2022-05-27
下一篇:
Python statistics.variance函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap