本文整理汇总了Python中pyLibrary.maths.Math.is_nan方法的典型用法代码示例。如果您正苦于以下问题:Python Math.is_nan方法的具体用法?Python Math.is_nan怎么用?Python Math.is_nan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyLibrary.maths.Math
的用法示例。
在下文中一共展示了Math.is_nan方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __new__
# 需要导入模块: from pyLibrary.maths import Math [as 别名]
# 或者: from pyLibrary.maths.Math import is_nan [as 别名]
def __new__(cls, value=None, **kwargs):
output = object.__new__(cls)
if value == None:
if kwargs:
output.milli = datetime.timedelta(**kwargs).total_seconds() * 1000
output.month = 0
return output
else:
return None
if Math.is_number(value):
output._milli = float(value) * 1000
output.month = 0
return output
elif isinstance(value, basestring):
return parse(value)
elif isinstance(value, Duration):
output.milli = value.milli
output.month = value.month
return output
elif isinstance(value, float) and Math.is_nan(value):
return None
else:
from pyLibrary import convert
from pyLibrary.debugs.logs import Log
Log.error("Do not know type of object (" + convert.value2json(value) + ")of to make a Duration")
示例2: stats
# 需要导入模块: from pyLibrary.maths import Math [as 别名]
# 或者: from pyLibrary.maths.Math import is_nan [as 别名]
def stats(values):
"""
RETURN LOTS OF AGGREGATES
"""
if values == None:
return None
values = values.map(float, includeNone=False)
z = ZeroMoment.new_instance(values)
s = Struct()
for k, v in z.dict.items():
s[k] = v
for k, v in ZeroMoment2Stats(z).items():
s[k] = v
s.max = MAX(values)
s.min = MIN(values)
s.median = pyLibrary.stats.median(values, simple=False)
s.last = values.last()
s.first = values[0]
if Math.is_number(s.variance) and not Math.is_nan(s.variance):
s.std = sqrt(s.variance)
return s