Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
36
Issue boards
Milestones
Wiki
Code
Merge requests
8
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rdm-software
SaQC
Commits
84617a18
Commit
84617a18
authored
4 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Patches
Plain Diff
simplified squeeze, as suggested by
@schaefed
parent
8e72568d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!218
Flags
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
saqc/flagger/history.py
+14
-21
14 additions, 21 deletions
saqc/flagger/history.py
test/flagger/test_history.py
+1
-1
1 addition, 1 deletion
test/flagger/test_history.py
with
15 additions
and
22 deletions
saqc/flagger/history.py
+
14
−
21
View file @
84617a18
...
...
@@ -230,27 +230,20 @@ class History:
if
n
>
len
(
self
):
raise
ValueError
(
f
"'
n=
{
n
}
'
cannot be greater than columns in the FH
"
)
# shortcut
if
len
(
self
)
==
n
:
s
=
self
.
max
()
self
.
hist
=
pd
.
DataFrame
()
self
.
mask
=
pd
.
DataFrame
()
else
:
# calc the squeezed series.
# we dont have to care about any forced series
# because anytime force was given, the False's in
# the mask were propagated back over the whole FH
mask
=
self
.
mask
.
iloc
[:,
-
n
:]
hist
=
self
.
hist
.
iloc
[:,
-
n
:]
s
=
hist
[
mask
].
max
(
axis
=
1
)
# slice self down
# this may leave us in an unstable state, because
# the last column may not is entirely True, but
# the following append, will fix this
self
.
hist
=
self
.
hist
.
iloc
[:,
:
-
n
]
self
.
mask
=
self
.
mask
.
iloc
[:,
:
-
n
]
# calc the squeezed series.
# we dont have to care about any forced series
# because anytime force was given, the False's in
# the mask were propagated back over the whole FH
mask
=
self
.
mask
.
iloc
[:,
-
n
:]
hist
=
self
.
hist
.
iloc
[:,
-
n
:]
s
=
hist
[
mask
].
max
(
axis
=
1
)
# slice self down
# this may leave us in an unstable state, because
# the last column maybe is not entirely True, but
# the following append, will fix this
self
.
hist
=
self
.
hist
.
iloc
[:,
:
-
n
]
self
.
mask
=
self
.
mask
.
iloc
[:,
:
-
n
]
self
.
append
(
s
)
return
self
...
...
This diff is collapsed.
Click to expand it.
test/flagger/test_history.py
+
1
−
1
View file @
84617a18
...
...
@@ -234,7 +234,7 @@ def test_squeeze():
# checks
for
n
in
range
(
len
(
orig
)):
for
n
in
range
(
len
(
orig
)
+
1
):
hist
=
orig
.
copy
()
hist
.
squeeze
(
n
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment