示例#1
0
def test_std(dictionary, expected):
    myDF = DataFrame(dictionary)
    assert myDF.std() == expected
示例#2
0
def test_mean(dictionary, expected):
    myDF = DataFrame(dictionary)
    assert myDF.mean() == expected
示例#3
0
def test_var(dictionary, expected):
    myDF = DataFrame(dictionary)
    assert myDF.var() == expected
示例#4
0
def test_get_row_errors():
    with pytest.raises(IndexError):
        myDF = DataFrame(npDict1)
        x = myDF.get_row(5)
示例#5
0
def test_get_row(dictionary, arg, expected):
    myDF = DataFrame(dictionary)
    assert myDF.get_row(arg) == expected
示例#6
0
def test_set_item(dictionary, arg, value):
    myDF = DataFrame(dictionary)
    myDF[arg] = value
    np.testing.assert_array_equal(myDF[arg], np.array(value))
示例#7
0
def test_create_DF_from_list_of_lists(data, expected_df):
    df = DataFrame(data)

    assert (df.data == expected_df).all()
示例#8
0
def test_create_DF_from_nparray(data, expected_df):
    df = DataFrame(data)

    assert (df.data == expected_df).all()
# test_get2
from ie_pandas import DataFrame
import numpy as np

# Define test to get more than one item
def test_get():

	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]),
		}

  group0 = ["cat","dog"]

	df=DataFrame(dictionary)

	assert df[["pet"]][0:2] == group0
示例#10
0
def test_initialization_No_Params():
    with pytest.raises(ValueError) as ValError:
        # Error on Object Generation so Fail.  Data needed
        df = DataFrame()