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
1e5d48c4
Commit
1e5d48c4
authored
4 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Patches
Plain Diff
Apply 7 suggestion(s) to 2 file(s)
parent
941b1a04
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/common.py
+1
-1
1 addition, 1 deletion
saqc/common.py
saqc/flagger/flags.py
+7
-19
7 additions, 19 deletions
saqc/flagger/flags.py
with
8 additions
and
20 deletions
saqc/common.py
+
1
−
1
View file @
1e5d48c4
...
...
@@ -5,5 +5,5 @@ from numpy import nan as _nan
UNTOUCHED
=
_nan
UNFLAGGED
=
0
DOUBTFUL
=
25
BAD
=
99
BAD
=
255
This diff is collapsed.
Click to expand it.
saqc/flagger/flags.py
+
7
−
19
View file @
1e5d48c4
...
...
@@ -72,7 +72,6 @@ class Flags:
raw_data
=
raw_data
.
_data
# with python 3.7 dicts are insertion-ordered by default
self
.
_data
:
Dict
[
str
,
History
]
self
.
_data
=
self
.
_init_from_raw
(
raw_data
,
copy
)
# this is a simple cache that reduce the calculation of the flags
...
...
@@ -117,7 +116,7 @@ class Flags:
@property
def
_constructor
(
self
)
->
Type
[
'
Flags
'
]:
return
Flags
return
type
(
self
)
# ----------------------------------------------------------------------
# mata data
...
...
@@ -143,7 +142,7 @@ class Flags:
_data
,
_cache
=
{},
{}
for
old
,
new
in
zip
(
self
.
columns
,
value
):
_data
[
new
]
=
self
.
_data
.
pop
(
old
)
_data
[
new
]
=
self
.
_data
[
old
]
if
old
in
self
.
_cache
:
_cache
[
new
]
=
self
.
_cache
[
old
]
...
...
@@ -179,13 +178,10 @@ class Flags:
return
if
key
not
in
self
.
_data
:
hist
=
History
()
else
:
hist
=
self
.
_data
[
key
]
hist
.
append
(
value
,
force
=
force
)
self
.
_cache
.
pop
(
key
,
None
)
self
.
_data
[
key
]
=
History
()
self
.
_data
[
key
].
append
(
value
,
force
=
force
)
self
.
_cache
.
pop
(
key
,
None
)
def
force
(
self
,
key
:
str
,
value
:
pd
.
Series
)
->
Flags
:
"""
...
...
@@ -209,7 +205,7 @@ class Flags:
return
self
def
__delitem__
(
self
,
key
):
del
self
.
_data
[
key
]
self
.
_data
.
pop
(
key
)
self
.
_cache
.
pop
(
key
,
None
)
def
drop
(
self
,
key
:
str
):
...
...
@@ -328,11 +324,3 @@ def init_flags_like(reference: Union[pd.Series, _DictLike, Flags], initial_value
return
Flags
(
result
)
if
__name__
==
'
__main__
'
:
from
dios
import
example_DictOfSeries
f
=
init_flags_like
(
example_DictOfSeries
(),
initial_value
=-
3.
)
print
(
f
)
print
(
Flags
())
print
(
Flags
(
example_DictOfSeries
().
astype
(
float
)))
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