コード例 #1
0
ファイル: test_data_adapter.py プロジェクト: Wombatpm/bokeh
    def test_ordered_dict(self):
        da = DataAdapter(self._values)

        self.assertEqual(da.values(), list(self._values.values()))
        self.assertEqual(da.columns, ['first', 'second', 'third'])
        self.assertEqual(da.keys(), ['first', 'second', 'third'])
        self.assertEqual(da.index, ['a', 'b', 'c'])
コード例 #2
0
    def test_ordered_dict(self):
        da = DataAdapter(self._values)

        self.assertEqual(da.values(), list(self._values.values()))
        self.assertEqual(da.columns, ['first', 'second', 'third'])
        self.assertEqual(da.keys(), ['first', 'second', 'third'])
        self.assertEqual(da.index, ['a', 'b', 'c'])
コード例 #3
0
ファイル: test_data_adapter.py プロジェクト: Wombatpm/bokeh
    def test_array(self):
        values = np.array(list(self._values.values()))
        da = DataAdapter(values)

        assert_array_equal(da.values(), list(self._values.values()))
        self.assertEqual(da.columns, ['0', '1', '2'])
        self.assertEqual(da.keys(), ['0', '1', '2'])
        self.assertEqual(da.index, ['a', 'b', 'c'])
コード例 #4
0
    def test_array(self):
        values = np.array(list(self._values.values()))
        da = DataAdapter(values)

        assert_array_equal(da.values(), list(self._values.values()))
        self.assertEqual(da.columns, ['0', '1', '2'])
        self.assertEqual(da.keys(), ['0', '1', '2'])
        self.assertEqual(da.index, ['a', 'b', 'c'])
コード例 #5
0
ファイル: test_data_adapter.py プロジェクト: Wombatpm/bokeh
    def test_pandas(self):
        values = pd.DataFrame(self._values)
        da = DataAdapter(values)

        # TODO: THIS SHOULD BE FIXED..
        #self.assertEqual(da.values(), list(self._values.values()))
        self.assertEqual(da.columns, ['first', 'second', 'third'])
        self.assertEqual(da.keys(), ['first', 'second', 'third'])
        # We expect data adapter index to be the same as the underlying pandas
        # object and not the default created by DataAdapter
        self.assertEqual(da.index, [0, 1, 2])
コード例 #6
0
    def test_pandas(self):
        values = pd.DataFrame(self._values)
        da = DataAdapter(values)

        # TODO: THIS SHOULD BE FIXED..
        #self.assertEqual(da.values(), list(self._values.values()))
        self.assertEqual(da.columns, ['first', 'second', 'third'])
        self.assertEqual(da.keys(), ['first', 'second', 'third'])
        # We expect data adapter index to be the same as the underlying pandas
        # object and not the default created by DataAdapter
        self.assertEqual(da.index, [0, 1, 2])
コード例 #7
0
    def test_blaze_data_no_fields(self):
        import blaze
        valuesdf = pd.DataFrame(self._values)
        values = blaze.Data(valuesdf)
        da = DataAdapter(values)

        assert_array_equal(da.values(), list(self._values.values()))
        self.assertEqual(da.columns, ['first', 'second', 'third'])
        self.assertEqual(da.keys(), ['first', 'second', 'third'])
        self.assertEqual(da.index, [0, 1, 2])

        xs, _values = DataAdapter.get_index_and_data(values, None)
        assert_array_equal([0, 1, 2], xs)
コード例 #8
0
ファイル: test_data_adapter.py プロジェクト: CatherineH/bokeh
    def test_blaze_data_no_fields(self):
        import blaze
        valuesdf = pd.DataFrame(self._values)
        values = blaze.Data(valuesdf)
        da = DataAdapter(values)

        assert_array_equal(da.values(), list(self._values.values()))
        self.assertEqual(da.columns, ['first', 'second', 'third'])
        self.assertEqual(da.keys(), ['first', 'second', 'third'])
        self.assertEqual(da.index, [0, 1, 2])

        xs, _values = DataAdapter.get_index_and_data(values, None)
        assert_array_equal([0,1,2], xs)