def test_add_height_relative_to_others():
    df = DDF({
        'number_of_stories': [5, 2, 1, 5, 3],
        'average_surrounding_building_heights': [5, 6, 1, 5, 1],
        'number_of_buildings_in_city': [1, 2, 1, 1, 2],
    })
    expected = DDF({
        'number_of_stories': [5, 2, 1, 5, 3],
        'average_surrounding_building_heights': [5, 6, 1, 5, 1],
        'number_of_buildings_in_city': [1, 2, 1, 1, 2],
        'relative_height': [5, -4, 1, 5, 2],
    })
    output = combined.add_height_relative_to_others(df)
    assert expected.equals(output)
def test_clean_rent():
    df = DDF({'rent': ['$26.57/fs', '-', '$24.92/+util']})
    expected = DDF({'rent': [26.57, np.nan, 24.92]})
    output = datasets.clean_rent(df)
    assert expected.equals(output)
def test_drop_rows_with_missing_rent():
    df = DDF({'rent': [26.57, np.nan, 24.92, 550.35]})
    expected = DDF({'rent': [26.57, 24.92]})
    output = datasets.drop_rows_with_missing_rent(df)
    assert expected.equals(output)
Example #4
0
def test_equals_returns_false_when_columns_are_not_the_same():
    df = DDF({'col1': np.array([1, 2])})
    df2 = DDF({'col2': np.array([1, 2])})
    assert not df.equals(df2)