Example #1
0
def test_input_mixed_in_np_max():
    obj = np.array([30, 53.0, "31", True, 32])
    df = DataFrame(obj, colindex=["AGE"], rowindex=["A", "B", "C", "D", "E"])

    expected_output = []

    actual_output = df.max()

    assert actual_output == expected_output
Example #2
0
def test_input_int_in_np_max():
    obj = np.array([30, 53, 31, 47, 32])
    df = DataFrame(obj, colindex=["AGE"], rowindex=["A", "B", "C", "D", "E"])

    expected_output = [53]

    actual_output = df.max()

    assert actual_output == expected_output
Example #3
0
def test_input_int_in_list_of_lists_max():
    obj = [[30, 53, 31, 47, 32], [4, 10, 2, 5, 4]]
    df = DataFrame(
        obj, colindex=["AGE", "ALBUMS"], rowindex=["A", "B", "C", "D", "E"]
    )

    expected_output = [53, 10]

    actual_output = df.max()

    assert actual_output == expected_output
Example #4
0
def test_input_int_in_dict_of_np_max():
    obj = {
        "age": np.array([30, 53, 31, 47, 32]),
        "albums": np.array([4, 10, 2, 5, 4]),
    }
    df = DataFrame(obj,
                   colindex=["AGE", "ALBUMS"],
                   rowindex=["A", "B", "C", "D", "E"])

    expected_output = [53, 10]

    actual_output = df.max()

    assert actual_output == expected_output
Example #5
0
def test_max_df():
    data = {
        "value1": [1, 2, 3, 4, 5, 6],
        "value2": [2, 2, 2, 2, 2, 2],
        "value3": [1.1, 2.2, 3.3, 4.4, 5.5, 6.6],
        "value4": ["a", "b", "c", "d", "e", "f"],
    }
    expected_output = np.array([6, 2, 6.6, None])
    df = DataFrame(data)
    max_output = df.max()
    print(max_output)
    print(expected_output)

    assert max_output.all() == expected_output.all()
Example #6
0
def test_input_mixed_in_dict_of_np_max():
    obj = {
        "age": np.array([30.1, 53.1, 31.1, 47.1, 32.1]),
        "albums": np.array([4, 10, 2, 5, 4]),
        "C": np.array(["a", "b", "c", "d", "e"]),
        "D": np.array([True, False, True, True, False]),
    }
    df = DataFrame(
        obj,
        colindex=["AGE", "ALBUMS", "C", "D"],
        rowindex=["A", "B", "C", "D", "E"],
    )

    expected_output = [53.1, 10, True]

    actual_output = df.max()

    assert actual_output == expected_output
def test_input_mixed_in_list_of_lists_max():
    obj = [
        [30.1, 53.1, 31.1, 47.1, 32.1],
        [4, 10, 2, 5, 4],
        ["a", "b", "c", "d", "e"],
        [True, False, True, True, False],
    ]
    df = DataFrame(
        obj,
        colindex=["AGE", "ALBUMS", "C", "D"],
        rowindex=["A", "B", "C", "D", "E"],
    )

    expected_output = [53.1, 10, True]

    actual_output = df.max()

    assert actual_output == expected_output
def test_max():

    dictionary = {
        "pet": np.array(["cat", "dog", "mouse"]),
        "age": np.array([1, 2, 3]),
        "weight": np.array([1.0, 2.0, 3.0]),
        "sick": np.array([True, True, False]),
    }

    df = DataFrame(dictionary)
    max_collector = []
    columns = []
    for key in dictionary:
        if dictionary[key].dtype == "float64" or \
           dictionary[key].dtype == "int32":
            columns.append(key)
            max_collector.append(max(dictionary[key]))

    expected_output = max_collector

    output = df.max()

    assert output == expected_output
Example #9
0
def test_max(dictionary, expected):
    myDF = DataFrame(dictionary)
    assert myDF.max() == expected