Пример #1
0
 def test_idxmapping_groupby_unsorted(self):
     data = [(('B', 2), 1), (('C', 2), 2), (('A', 1), 3)]
     grouped = MultiDimensionalMapping(data, sort=False,
                                       kdims=['X', 'Y']).groupby('Y')
     self.assertEquals(grouped.keys(), [1, 2])
     self.assertEquals(grouped.values()[0].keys(), ['A'])
     self.assertEquals(grouped.last.keys(), ['B', 'C'])
Пример #2
0
    def test_idxmapping_apply_key_type(self):
        data = dict([(0.5, 'a'), (1.5, 'b')])
        ndmap = MultiDimensionalMapping(data, key_dimensions=[self.dim1])

        self.assertEqual(list(ndmap.keys()), [0, 1])
Пример #3
0
 def test_idxmapping_unsorted_clone(self):
     data = [('B', 1), ('C', 2), ('A', 3)]
     ndmap = MultiDimensionalMapping(data, sort=False).clone()
     self.assertEquals(ndmap.keys(), ['B', 'C', 'A'])
Пример #4
0
    def test_idxmapping_apply_key_type(self):
        data = dict([(0.5, 'a'), (1.5, 'b')])
        ndmap = MultiDimensionalMapping(data, kdims=[self.dim1])

        self.assertEqual(list(ndmap.keys()), [0, 1])
Пример #5
0
 def test_idxmapping_groupby_unsorted(self):
     data = [(('B', 2), 1), (('C', 2), 2), (('A', 1), 3)]
     grouped = MultiDimensionalMapping(data, sort=False, kdims=['X', 'Y']).groupby('Y')
     self.assertEquals(grouped.keys(), [1, 2])
     self.assertEquals(grouped.values()[0].keys(), ['A'])
     self.assertEquals(grouped.last.keys(), ['B', 'C'])
Пример #6
0
 def test_idxmapping_unsorted_clone(self):
     data = [('B', 1), ('C', 2), ('A', 3)]
     ndmap = MultiDimensionalMapping(data, sort=False).clone()
     self.assertEquals(ndmap.keys(), ['B', 'C', 'A'])