本文整理汇总了Python中Orange.data.ContinuousVariable.str_val方法的典型用法代码示例。如果您正苦于以下问题:Python ContinuousVariable.str_val方法的具体用法?Python ContinuousVariable.str_val怎么用?Python ContinuousVariable.str_val使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.data.ContinuousVariable
的用法示例。
在下文中一共展示了ContinuousVariable.str_val方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_adjust_decimals
# 需要导入模块: from Orange.data import ContinuousVariable [as 别名]
# 或者: from Orange.data.ContinuousVariable import str_val [as 别名]
def test_adjust_decimals(self):
a = ContinuousVariable("a")
self.assertEqual(a.str_val(4.65432), "4.65432")
a.val_from_str_add("5")
self.assertEqual(a.str_val(4.65432), "5")
a.val_from_str_add(" 5.12 ")
self.assertEqual(a.str_val(4.65432), "4.65")
a.val_from_str_add("5.1234")
self.assertEqual(a.str_val(4.65432), "4.6543")
示例2: test_decimals
# 需要导入模块: from Orange.data import ContinuousVariable [as 别名]
# 或者: from Orange.data.ContinuousVariable import str_val [as 别名]
def test_decimals(self):
a = ContinuousVariable("a", 4)
self.assertEqual(a.str_val(4.654321), "4.6543")
self.assertEqual(a.str_val(4.654321654321), "4.6543")
self.assertEqual(a.str_val(Unknown), "?")
a = ContinuousVariable("a", 5)
self.assertEqual(a.str_val(0.000000000001), "0.00000")
a = ContinuousVariable("a", 10)
self.assertEqual(a.str_val(0.000000000001), "1e-12")
示例3: test_decimals
# 需要导入模块: from Orange.data import ContinuousVariable [as 别名]
# 或者: from Orange.data.ContinuousVariable import str_val [as 别名]
def test_decimals(self):
a = ContinuousVariable("a", 4)
self.assertEqual(a.str_val(4.654321), "4.6543")
self.assertEqual(a.str_val(Unknown), "?")