Ejemplo n.º 1
0
def test_arrange_at():
    df = pd.DataFrame({
        'alpha': list('aaabbb'),
        'beta': list('babruq'),
        'theta': list('cdecde'),
        'x': [1, 2, 3, 4, 5, 6],
        'y': [6, 5, 4, 3, 2, 1],
        'z': [7, 9, 11, 8, 10, 12]
    })

    result1 = df >> arrange_at(dict(matches=r'.*'))
    result2 = df >> arrange_all()
    assert result1.equals(result2)
Ejemplo n.º 2
0
def test_arrange_all():
    df = pd.DataFrame({
        'alpha': list('aaabbb'),
        'beta': list('babruq'),
        'theta': list('cdecde'),
        'x': [1, 2, 3, 4, 5, 6],
        'y': [6, 5, 4, 3, 2, 1],
        'z': [7, 9, 11, 8, 10, 12]
    })

    result = df >> select('x', 'y', 'z') >> arrange_all(np.negative)
    assert all(result['x'] == [6, 5, 4, 3, 2, 1])
    assert all(result['y'] == [1, 2, 3, 4, 5, 6])
    assert all(result['z'] == [12, 10, 8, 11, 9, 7])