Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
alpha-mind
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dr.李
alpha-mind
Commits
89ecac54
Commit
89ecac54
authored
May 15, 2018
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug when single sub group having only one sample
parent
620588f4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
2 deletions
+1
-2
test_sql_engine.py
alphamind/tests/data/engines/test_sql_engine.py
+1
-2
No files found.
alphamind/tests/data/engines/test_sql_engine.py
View file @
89ecac54
...
@@ -402,12 +402,11 @@ class TestSqlEngine(unittest.TestCase):
...
@@ -402,12 +402,11 @@ class TestSqlEngine(unittest.TestCase):
expected_rank
=
df3
[[
'ROE'
,
'cat'
]]
.
groupby
(
'cat'
)
.
transform
(
lambda
x
:
rankdata
(
x
.
values
)
-
1.
)
expected_rank
=
df3
[[
'ROE'
,
'cat'
]]
.
groupby
(
'cat'
)
.
transform
(
lambda
x
:
rankdata
(
x
.
values
)
-
1.
)
expected_rank
[
np
.
isnan
(
df3
.
ROE
)]
=
np
.
nan
expected_rank
[
np
.
isnan
(
df3
.
ROE
)]
=
np
.
nan
expected_rank
[
np
.
isnan
(
df3
.
ROE
)]
=
np
.
nan
df3
[
'rank'
]
=
expected_rank
[
'ROE'
]
.
values
df3
[
'rank'
]
=
expected_rank
[
'ROE'
]
.
values
np
.
testing
.
assert_array_almost_equal
(
df3
[
'rank'
]
.
values
,
np
.
testing
.
assert_array_almost_equal
(
df3
[
'rank'
]
.
values
,
df1
[
'f'
]
.
values
)
df1
[
'f'
]
.
values
)
expected_quantile
=
df3
[[
'ROE'
,
'cat'
]]
.
groupby
(
'cat'
)
.
transform
(
lambda
x
:
(
rankdata
(
x
.
values
)
-
1.
)
/
(
len
(
x
)
-
1
))
expected_quantile
=
df3
[[
'ROE'
,
'cat'
]]
.
groupby
(
'cat'
)
.
transform
(
lambda
x
:
(
rankdata
(
x
.
values
)
-
1.
)
/
(
(
len
(
x
)
-
1.
)
if
len
(
x
)
>
1
else
1.
))
expected_quantile
[
np
.
isnan
(
df3
.
ROE
)]
=
np
.
nan
expected_quantile
[
np
.
isnan
(
df3
.
ROE
)]
=
np
.
nan
df3
[
'quantile'
]
=
expected_quantile
[
'ROE'
]
.
values
df3
[
'quantile'
]
=
expected_quantile
[
'ROE'
]
.
values
np
.
testing
.
assert_array_almost_equal
(
df3
[
'quantile'
]
.
values
,
np
.
testing
.
assert_array_almost_equal
(
df3
[
'quantile'
]
.
values
,
...
...
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