本文整理汇总了Python中pml.data.model.DataSet.get_row方法的典型用法代码示例。如果您正苦于以下问题:Python DataSet.get_row方法的具体用法?Python DataSet.get_row怎么用?Python DataSet.get_row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pml.data.model.DataSet
的用法示例。
在下文中一共展示了DataSet.get_row方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_row
# 需要导入模块: from pml.data.model import DataSet [as 别名]
# 或者: from pml.data.model.DataSet import get_row [as 别名]
def test_get_row(self):
dataset = DataSet([[1, 2], [3, 4], [5, 6], [7, 8]])
row = dataset.get_row(1)
assert_that(row.values, contains(3, 4))
# check that changes made to selected row are reflected in original
row[:] = 1
assert_that(dataset.get_row(1), contains(1, 1))
示例2: test_get_row_by_id
# 需要导入模块: from pml.data.model import DataSet [as 别名]
# 或者: from pml.data.model.DataSet import get_row [as 别名]
def test_get_row_by_id(self):
df = pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 9]],
index=["V01", "V02", "V03"])
dataset = DataSet(df)
sample = dataset.get_row("V02")
assert_that(sample, contains(4, 5, 6))
# make sure position based index is still usable
sample = dataset.get_row(1)
assert_that(sample, contains(4, 5, 6))
示例3: test_get_last_row
# 需要导入模块: from pml.data.model import DataSet [as 别名]
# 或者: from pml.data.model.DataSet import get_row [as 别名]
def test_get_last_row(self):
dataset = DataSet([[1, 2], [3, 4], [5, 6], [7, 8]])
assert_that(dataset.get_row(dataset.num_samples() - 1), contains(7, 8))