예제 #1
0
def test_ContinuoustoCategory_chained_float_fixed():
    nc = 6
    nr = 1000000
    delta = 0.1
    farr = np.arange(0, (nr * delta * nc), delta, dtype=float).reshape(nr, nc)
    toDataFrame(farr, labels=[]).toContinuousCategory(quantile=False,
                                                      nbin=3,
                                                      drop=False)
예제 #2
0
def test_toDatetimeComponents_make_4feature():
    from datetime import datetime, timedelta

    darr = np.arange(datetime(1751, 7, 1), datetime(2015, 7, 1),
                     timedelta(days=1)).reshape(24106, 4)
    rc = 24106
    cc = 52
    assert toDataFrame(
        darr, labels=[]).toDatetimeComponents(inplace=False).shape == (rc, cc)
예제 #3
0
def test_toDataFrame_csr_kinky():
    r = 3
    c = 3
    indptr = np.array([0, 2, 3, 6])
    indices = np.array([0, 2, 2, 0, 1, 2])
    data = np.array([1, 2, 3, 4, 5, 6])
    csr = scipy.sparse.csr_matrix((data, indices, indptr),
                                  shape=(3, 3)).todense()
    assert toDataFrame(csr, labels=[]).toDataFrame().shape == (r, c)
예제 #4
0
def test_toDatetimeComponents_make_1feature():
    from datetime import datetime, timedelta

    rc = 94598
    cc = 1
    acc = 13
    darr = np.arange(datetime(1751, 7, 1), datetime(2010, 7, 1),
                     timedelta(days=1)).reshape(rc, cc)
    assert toDataFrame(
        darr, labels=[]).toDatetimeComponents(inplace=False).shape == (rc, acc)
예제 #5
0
def test_2d_named_kinky(X, cnv):
    assert toDataFrame(X, labels=cnv).toDataFrame().columns[2] == cnv[2]
예제 #6
0
def test_2d_named_too_many_args(X, cnv):
    with pytest.raises(TypeError):
        toDataFrame(X, cnv, cnv, X, 5, 6).columns[2] == cnv[2]
예제 #7
0
def test_toDataFrame_list_1d():
    assert len(toDataFrame([[1, 2, 3]]).columns) == 3
예제 #8
0
def test_df_labels_set(X, cnv):
    assert (toDataFrame(pd.DataFrame(X, columns=cnv),
                        labels=cnv).columns == cnv).all()
예제 #9
0
def test_3dArray_numpy(X):
    with pytest.raises(ValueError):
        toDataFrame(np.reshape(X, (-1, -1, 1)))
예제 #10
0
def test_Class_init_BadArg():
    with pytest.raises(TypeError):
        toDataFrame(fred=1)
예제 #11
0
def test_toDataFrame_series():
    r = 100
    c = 1
    arr = np.ndarray(shape=(r), dtype=float, order="F")
    s = pd.Series(arr)
    assert toDataFrame(s, labels=[]).shape == (r, c)
예제 #12
0
def test_toDataFrame_array3d_error():
    r = 100
    c = 10
    arr = np.ndarray(shape=(2, r, c), dtype=float, order="F")
    with pytest.raises(PasoError):
        assert toDataFrame(arr, labels=[]).shape == (r, c)
예제 #13
0
def test_toDataFrame_array():
    r = 100
    c = 10
    arr = np.ndarray(shape=(r, c), dtype=float, order="F")
    assert toDataFrame(arr).shape == (r, c)
예제 #14
0
def test_toDataFrame_list_2d():
    assert toDataFrame([[1, 2, 3], [4, 5, 5]]).shape == (2, 3)
예제 #15
0
def test_Blank_Arg_Transform():
    with pytest.raises(TypeError):
        toDataFrame()
예제 #16
0
def test_Empty_list_Arg_Transform():
    with pytest.raises(PasoError):
        toDataFrame([])
예제 #17
0
def test_2d_numpy_labels_method_(X, cn):
    assert toDataFrame(X, labels=cn).toDataFrame().columns[1] == "k"
예제 #18
0
def test_ContinuoustoCategory_chained_float_unique_1_ERROR():
    farr = np.ndarray(shape=(1000000, 4), dtype=float, order="F")
    with pytest.raises(IndexError):
        toDataFrame(farr, labels=[]).toContinuousCategory(drop=False)
예제 #19
0
def test_2d_numpy_labels_default(X, cn):
    assert toDataFrame(X).columns[1] == "c_1"
예제 #20
0
def test_1d_numpy_bad_arg(y, cn):
    with pytest.raises(PasoError):
        toDataFrame(y)
예제 #21
0
def test_toDataFrame_list():
    assert len(toDataFrame([1, 2, 3], labels=[]).columns) == 1