码迷,mamicode.com
首页 > 其他好文 > 详细

中位数定义及示例

时间:2014-07-14 23:49:19      阅读:334      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   color   os   art   

bubuko.com,布布扣

def Median(t):
    """中位数"""
    arr = sorted(t)
    idx = (len(arr) - 1) / 2
    if type(idx) is int:
        return arr[idx]
    if type(idx) is float:
        return Mean(arr[int(math.floor(idx)):int(math.ceil(idx)) + 1])

 

中位数定义及示例,布布扣,bubuko.com

中位数定义及示例

标签:des   style   blog   color   os   art   

原文地址:http://www.cnblogs.com/data80386/p/3842225.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!