예제 #1
0
def test_flat_corr_nan_column():
    nan_col_df = ex_df.copy(deep=True)
    nan_col_df.iloc[:,0] = np.nan
    assert flat_corr(nan_col_df).shape[0] == comb(nan_col_df.shape[1], 2, exact=True)
예제 #2
0
def test_flat_corr_int_columns():
    assert flat_corr(ex_df, columnns=slice(1)).shape[0] == comb(ex_df.shape[1] - 1, 2, exact=True)
예제 #3
0
def test_flat_corr_arrangement():
    res = flat_corr(ex_df)
    res_asc = flat_corr(ex_df, ascending=True)
    np.testing.assert_allclose(res_asc['pearson'], np.sort(squareform(ex_df.corr(), checks=False)))
    assert res.iloc[0,0] > res.iloc[-1,0]
    assert res_asc.iloc[0,0] < res_asc.iloc[-1,0]
예제 #4
0
def test_flat_corr_method():
    assert flat_corr(ex_df, method='spearman').notna().all(None)
예제 #5
0
def test_flat_corr_shape_nans():
    assert flat_corr(ex_missing_df).shape[0] == comb(ex_missing_df.shape[1], 2, exact=True)
    assert flat_corr(ex_missing_df).shape[0] == squareform(ex_missing_df.corr(), checks=False).shape[0]
    assert flat_corr(ex_missing_df, columnns=[*'ABC']).shape[0] == comb(3, 2, exact=True)