本文整理汇总了Python中pml.data.model.DataSet.bin方法的典型用法代码示例。如果您正苦于以下问题:Python DataSet.bin方法的具体用法?Python DataSet.bin怎么用?Python DataSet.bin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pml.data.model.DataSet
的用法示例。
在下文中一共展示了DataSet.bin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bin_feature
# 需要导入模块: from pml.data.model import DataSet [as 别名]
# 或者: from pml.data.model.DataSet import bin [as 别名]
def test_bin_feature(self):
df = pd.DataFrame([[0, 1], [7, 2], [6, 3]],
columns=["MATH100", "PHYS125"])
dataset = DataSet(df)
dataset.bin("MATH100", [4, 7])
assert_that(dataset, equals_dataset([[0, 1], [2, 2], [1, 3]]))
示例2: test_bin_all
# 需要导入模块: from pml.data.model import DataSet [as 别名]
# 或者: from pml.data.model.DataSet import bin [as 别名]
def test_bin_all(self):
df = pd.DataFrame([[0, 6], [9, 2], [6, 4]],
columns=["MATH100", "PHYS125"])
dataset = DataSet(df)
dataset.bin("*", [4, 7], bin_names=["low", "mid", "high"])
assert_that(dataset, equals_dataset([["low", "mid"], ["high", "low"],
["mid", "mid"]]))
示例3: test_bin_feature_floats
# 需要导入模块: from pml.data.model import DataSet [as 别名]
# 或者: from pml.data.model.DataSet import bin [as 别名]
def test_bin_feature_floats(self):
df = pd.DataFrame([[3.5, 1], [9.1, 2], [6.2, 3]],
columns=["MATH100", "PHYS125"])
dataset = DataSet(df)
dataset.bin("MATH100", [3.9, 7], bin_names=["low", "mid", "high"])
assert_that(dataset, equals_dataset([["low", 1], ["high", 2],
["mid", 3]]))
示例4: test_bin_feature_1_boundary
# 需要导入模块: from pml.data.model import DataSet [as 别名]
# 或者: from pml.data.model.DataSet import bin [as 别名]
def test_bin_feature_1_boundary(self):
df = pd.DataFrame([[0, 1], [9, 2], [6, 3]],
columns=["MATH100", "PHYS125"])
dataset = DataSet(df)
dataset.bin("MATH100", [3], bin_names=["low", "high"])
assert_that(dataset, equals_dataset([["low", 1], ["high", 2],
["high", 3]]))