Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
funpack
Commits
13227e14
Commit
13227e14
authored
Aug 19, 2021
by
Paul McCarthy
🚵
Browse files
TEST: Suppress/avoid warnings
parent
3a285af0
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
funpack/tests/test_cleaning.py
View file @
13227e14
...
...
@@ -11,7 +11,7 @@ import string
import
textwrap
as
tw
import
multiprocessing
as
mp
from
unittest
import
mock
from
unittest
import
mock
import
pytest
...
...
@@ -514,10 +514,12 @@ def test_applyChildValues():
6
:
'text'
,
7
:
'integer'
})
vartable
.
loc
[
pvals
.
keys
(),
'ParentValues'
]
=
\
[
lt
.
convert_ParentValues
(
v
)
for
v
in
pvals
.
values
()]
vartable
.
loc
[
cvals
.
keys
(),
'ChildValues'
]
=
\
[
lt
.
convert_comma_sep_text
(
v
)
for
v
in
cvals
.
values
()]
vartable
.
loc
[
pvals
.
keys
(),
'ParentValues'
]
=
np
.
array
(
[
lt
.
convert_ParentValues
(
v
)
for
v
in
pvals
.
values
()],
dtype
=
object
)
vartable
.
loc
[
cvals
.
keys
(),
'ChildValues'
]
=
np
.
array
(
[
lt
.
convert_comma_sep_text
(
v
)
for
v
in
cvals
.
values
()],
dtype
=
object
)
finfo
=
fileinfo
.
FileInfo
(
'data.txt'
)
dt
,
_
=
importing
.
importData
(
finfo
,
...
...
funpack/tests/test_processing_core.py
View file @
13227e14
...
...
@@ -349,10 +349,12 @@ def wrapped_pairwiseRedundantColumns(df, corrthres):
return
core
.
pairwiseRedundantColumns
(
df
,
colpairs
,
corrthres
)
def
test_pairwiseRedundantColumns
():
_test_redundantColumns
(
wrapped_pairwiseRedundantColumns
)
with
np
.
errstate
(
divide
=
'ignore'
):
_test_redundantColumns
(
wrapped_pairwiseRedundantColumns
)
def
test_matrixRedundantColumns
():
_test_redundantColumns
(
core
.
matrixRedundantColumns
)
with
np
.
errstate
(
divide
=
'ignore'
):
_test_redundantColumns
(
core
.
matrixRedundantColumns
)
def
_test_redundantColumns
(
rcfunc
):
...
...
@@ -382,10 +384,12 @@ def _test_redundantColumns(rcfunc):
def
test_pairwiseRedundantColumns_associative
():
_test_redundantColumns_associative
(
wrapped_pairwiseRedundantColumns
)
with
np
.
errstate
(
divide
=
'ignore'
):
_test_redundantColumns_associative
(
wrapped_pairwiseRedundantColumns
)
def
test_matrixRedundantColumns_associative
():
_test_redundantColumns_associative
(
core
.
matrixRedundantColumns
)
with
np
.
errstate
(
divide
=
'ignore'
):
_test_redundantColumns_associative
(
core
.
matrixRedundantColumns
)
def
_test_redundantColumns_associative
(
rcfunc
):
...
...
@@ -452,12 +456,13 @@ def test_redundantColumns_na():
nathres
=
np
.
abs
(
nacorr
[
~
np
.
isclose
(
nacorr
,
1
)]).
mean
()
corrthres
=
np
.
abs
(
dcorr
[
~
np
.
isclose
(
dcorr
,
1
)]).
mean
()
nacorr
=
core
.
naCorrelation
(
pd
.
isna
(
df
),
nathres
)
colpairs
=
np
.
where
(
np
.
triu
(
nacorr
,
k
=
1
))
colpairs
=
np
.
vstack
(
colpairs
).
T
with
np
.
errstate
(
divide
=
'ignore'
):
nacorr
=
core
.
naCorrelation
(
pd
.
isna
(
df
),
nathres
)
colpairs
=
np
.
where
(
np
.
triu
(
nacorr
,
k
=
1
))
colpairs
=
np
.
vstack
(
colpairs
).
T
pairwise
=
core
.
pairwiseRedundantColumns
(
df
,
colpairs
,
corrthres
)
matrix
=
core
.
matrixRedundantColumns
(
df
,
corrthres
,
nathres
)
pairwise
=
core
.
pairwiseRedundantColumns
(
df
,
colpairs
,
corrthres
)
matrix
=
core
.
matrixRedundantColumns
(
df
,
corrthres
,
nathres
)
nacounts
=
np
.
isnan
(
data
).
sum
(
axis
=
0
)
corrmask
=
nacorr
&
(
np
.
abs
(
dcorr
)
>
corrthres
)
...
...
@@ -498,12 +503,12 @@ def test_redundantColumns_constant_allna():
data
[
9
,
1
]
=
np
.
nan
df
=
pd
.
DataFrame
(
data
.
T
)
nacorr
=
core
.
naCorrelation
(
pd
.
isna
(
df
),
0.1
)
colpairs
=
np
.
where
(
np
.
triu
(
nacorr
,
k
=
1
)
)
colpairs
=
np
.
vstack
(
colpairs
).
T
pairwise
=
core
.
pairwiseRedundantColumns
(
df
,
colpairs
,
0.2
)
matrix
=
core
.
matrixRedundantColumns
(
df
,
0.2
,
0.1
)
with
np
.
errstate
(
divide
=
'ignore'
):
nacorr
=
core
.
naCorrelation
(
pd
.
isna
(
df
),
0.
1
)
colpairs
=
np
.
where
(
np
.
triu
(
nacorr
,
k
=
1
))
colpairs
=
np
.
vstack
(
colpairs
).
T
pairwise
=
core
.
pairwiseRedundantColumns
(
df
,
colpairs
,
0.2
)
matrix
=
core
.
matrixRedundantColumns
(
df
,
0.2
,
0.1
)
pairwise
=
np
.
array
(
sorted
(
pairwise
))
matrix
=
np
.
array
(
sorted
(
matrix
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment