Esempio n. 1
0
def test_sort_0():
    t1 = Table()
    t1.add_column('a', [1, 2, 3, 4, 5])
    t1.add_column('b', [1, 2, 3])

    t2 = t1.copy()
    t3 = t1.copy()

    t4 = Table.from_chunks([t1, t2, t3])

    assert np.all(
        t4.b.index == np.array([1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0]))
Esempio n. 2
0
def test_vcat_heterogeneous():
    tb = Table({
        'a': pd.date_range('2000-01-01', freq='M', periods=3),
        'b': np.random.randn(3)
    })
    tb.add_column('schedule', np.array(['first']))
    tb1 = tb.copy()
    tb1.schedule.values[0] = 'second'
    tb.stack(tb1)
    assert np.all(tb.index == np.array(
        [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 0, 0, 1, 0, 0]],
        dtype=np.uint8))
    assert np.all(tb.schedule.values == np.array(['first', 'secon']))