Ejemplo n.º 1
0
 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))
Ejemplo n.º 2
0
 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))
Ejemplo n.º 3
0
 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))