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
1ec54cbe
Commit
1ec54cbe
authored
4 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Patches
Plain Diff
a snake is trampled by a camel
parent
e263e20d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!271
Static expansion of regular expressions
,
!260
Follow-Up Translations
,
!237
Flagger Translations
,
!232
WIP: Fuzzy testing
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
saqc/core/core.py
+2
-2
2 additions, 2 deletions
saqc/core/core.py
saqc/flagger/__init__.py
+1
-1
1 addition, 1 deletion
saqc/flagger/__init__.py
saqc/flagger/flags.py
+9
-9
9 additions, 9 deletions
saqc/flagger/flags.py
test/flagger/test_flags.py
+3
-3
3 additions, 3 deletions
test/flagger/test_flags.py
with
15 additions
and
15 deletions
saqc/core/core.py
+
2
−
2
View file @
1ec54cbe
...
...
@@ -20,7 +20,7 @@ import timeit
import
inspect
from
saqc.common
import
*
from
saqc.flagger
import
init
_f
lags
_l
ike
,
Flagger
from
saqc.flagger
import
init
F
lags
L
ike
,
Flagger
from
saqc.core.lib
import
APIController
,
ColumnSelector
from
saqc.core.register
import
FUNC_MAP
,
SaQCFunction
from
saqc.core.modules
import
FuncModules
...
...
@@ -123,7 +123,7 @@ class SaQC(FuncModules):
a flags frame or an already initialised flagger are used.
"""
if
flagger
is
None
:
return
init
_f
lags
_l
ike
(
data
)
return
init
F
lags
L
ike
(
data
)
for
c
in
flagger
.
columns
.
union
(
data
.
columns
):
if
c
in
flagger
:
...
...
This diff is collapsed.
Click to expand it.
saqc/flagger/__init__.py
+
1
−
1
View file @
1ec54cbe
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from
.flags
import
Flagger
,
init
_f
lags
_l
ike
from
.flags
import
Flagger
,
init
F
lags
L
ike
from
.history
import
History
This diff is collapsed.
Click to expand it.
saqc/flagger/flags.py
+
9
−
9
View file @
1ec54cbe
...
...
@@ -57,8 +57,8 @@ class Flags:
conversion
----------
make a dios -> flags.to
_d
ios()
make a df -> flags.to
_f
rame()
make a dios -> flags.to
D
ios()
make a df -> flags.to
F
rame()
"""
def
__init__
(
self
,
raw_data
:
Optional
[
Union
[
DictLike
,
Flags
]]
=
None
,
copy
:
bool
=
False
):
...
...
@@ -70,7 +70,7 @@ class Flags:
raw_data
=
raw_data
.
_data
# with python 3.7 dicts are insertion-ordered by default
self
.
_data
=
self
.
_init
_f
rom
_r
aw
(
raw_data
,
copy
)
self
.
_data
=
self
.
_init
F
rom
R
aw
(
raw_data
,
copy
)
# this is a simple cache that reduce the calculation of the flags
# from the entire history of a flag column. The _cache is filled
...
...
@@ -79,7 +79,7 @@ class Flags:
# have to much trouble.
self
.
_cache
=
{}
def
_init
_f
rom
_r
aw
(
self
,
data
,
copy
)
->
Dict
[
str
,
History
]:
def
_init
F
rom
R
aw
(
self
,
data
,
copy
)
->
Dict
[
str
,
History
]:
"""
init from dict-like: keys are flag column, values become
initial columns of history(s).
...
...
@@ -245,7 +245,7 @@ class Flags:
# ----------------------------------------------------------------------
# transformation and representation
def
to
_d
ios
(
self
)
->
dios
.
DictOfSeries
:
def
to
D
ios
(
self
)
->
dios
.
DictOfSeries
:
di
=
dios
.
DictOfSeries
(
columns
=
self
.
columns
)
for
k
,
v
in
self
.
_data
.
items
():
...
...
@@ -253,14 +253,14 @@ class Flags:
return
di
.
copy
()
def
to
_f
rame
(
self
)
->
pd
.
DataFrame
:
return
self
.
to
_d
ios
().
to_df
()
def
to
F
rame
(
self
)
->
pd
.
DataFrame
:
return
self
.
to
D
ios
().
to_df
()
def
__repr__
(
self
)
->
str
:
return
str
(
self
.
to
_d
ios
()).
replace
(
'
DictOfSeries
'
,
type
(
self
).
__name__
)
return
str
(
self
.
to
D
ios
()).
replace
(
'
DictOfSeries
'
,
type
(
self
).
__name__
)
def
init
_f
lags
_l
ike
(
reference
:
Union
[
pd
.
Series
,
DictLike
,
Flags
],
initial_value
:
float
=
UNFLAGGED
)
->
Flags
:
def
init
F
lags
L
ike
(
reference
:
Union
[
pd
.
Series
,
DictLike
,
Flags
],
initial_value
:
float
=
UNFLAGGED
)
->
Flags
:
"""
Create empty Flags, from an reference data structure.
...
...
This diff is collapsed.
Click to expand it.
test/flagger/test_flags.py
+
3
−
3
View file @
1ec54cbe
...
...
@@ -181,7 +181,7 @@ def test_cache():
assert
'
a
'
not
in
flags
.
_cache
# cache all
flags
.
to
_d
ios
()
flags
.
to
D
ios
()
for
c
in
flags
.
columns
:
assert
c
in
flags
.
_cache
...
...
@@ -202,7 +202,7 @@ def _validate_flags_equals_frame(flags, df):
@pytest.mark.parametrize
(
'
data
'
,
data
)
def
test_to_dios
(
data
:
np
.
array
):
flags
=
Flags
(
data
)
df
=
flags
.
to
_d
ios
()
df
=
flags
.
to
D
ios
()
assert
isinstance
(
df
,
dios
.
DictOfSeries
)
_validate_flags_equals_frame
(
flags
,
df
)
...
...
@@ -211,7 +211,7 @@ def test_to_dios(data: np.array):
@pytest.mark.parametrize
(
'
data
'
,
data
)
def
test_to_frame
(
data
:
np
.
array
):
flags
=
Flags
(
data
)
df
=
flags
.
to
_f
rame
()
df
=
flags
.
to
F
rame
()
assert
isinstance
(
df
,
pd
.
DataFrame
)
_validate_flags_equals_frame
(
flags
,
df
)
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