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
da54613c
Commit
da54613c
authored
11 months ago
by
Peter Lünenschloß
Browse files
Options
Downloads
Patches
Plain Diff
exposed target in rolling func
parent
2a9f61ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!850
Horizontal axis rolling
Pipeline
#207029
failed with stages
in 2 minutes and 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/funcs/rolling.py
+17
-11
17 additions, 11 deletions
saqc/funcs/rolling.py
with
17 additions
and
11 deletions
saqc/funcs/rolling.py
+
17
−
11
View file @
da54613c
...
@@ -34,6 +34,7 @@ class RollingMixin:
...
@@ -34,6 +34,7 @@ class RollingMixin:
self
:
"
SaQC
"
,
self
:
"
SaQC
"
,
field
:
str
,
field
:
str
,
window
:
str
|
int
,
window
:
str
|
int
,
target
:
str
=
None
,
func
:
Callable
[[
pd
.
Series
],
np
.
ndarray
]
|
str
=
"
mean
"
,
func
:
Callable
[[
pd
.
Series
],
np
.
ndarray
]
|
str
=
"
mean
"
,
min_periods
:
int
=
0
,
min_periods
:
int
=
0
,
center
:
bool
=
True
,
center
:
bool
=
True
,
...
@@ -55,6 +56,11 @@ class RollingMixin:
...
@@ -55,6 +56,11 @@ class RollingMixin:
sampled timeseries, the period number will be casted down to an odd number if
sampled timeseries, the period number will be casted down to an odd number if
``center=True``.
``center=True``.
target :
Field to write the result of the rolling calculation to. Will be generated if not existant.
If not given, `field` will be overwritten with the calculations result.
If multiple fields are given, `target` must be assigned.
func : default mean
func : default mean
Function to roll with.
Function to roll with.
...
@@ -66,9 +72,9 @@ class RollingMixin:
...
@@ -66,9 +72,9 @@ class RollingMixin:
"""
"""
# HINT: checking in _roll
# HINT: checking in _roll
if
len
(
field
)
==
1
:
if
len
(
field
)
==
1
:
if
"
target
"
in
kwargs
:
if
target
:
self
=
self
.
copyField
(
field
[
0
],
target
=
kwargs
[
"
target
"
]
)
self
=
self
.
copyField
(
field
[
0
],
target
=
target
)
field
=
kwargs
[
"
target
"
]
field
=
target
self
.
_data
,
self
.
_flags
=
_roll
(
self
.
_data
,
self
.
_flags
=
_roll
(
data
=
self
.
_data
,
data
=
self
.
_data
,
...
@@ -81,23 +87,23 @@ class RollingMixin:
...
@@ -81,23 +87,23 @@ class RollingMixin:
**
kwargs
,
**
kwargs
,
)
)
else
:
else
:
if
not
"
target
"
in
kwargs
:
if
not
target
:
raise
ValueError
(
raise
ValueError
(
"
Target has to be assigned for cross statistics calculations.
"
"
Target has to be assigned for cross statistics calculations.
"
)
)
for
t
in
kwargs
[
"
target
"
]:
if
t
not
in
self
.
_data
.
columns
:
if
target
not
in
self
.
_data
.
columns
:
self
[
t
]
=
saqc
.
SaQC
(
self
[
target
]
=
saqc
.
SaQC
(
pd
.
Series
(
pd
.
Series
(
np
.
nan
,
index
=
self
.
data
[
field
].
to_pandas
().
index
,
name
=
t
np
.
nan
,
index
=
self
.
data
[
field
].
to_pandas
().
index
,
name
=
target
)
)
)
)
self
.
_data
,
self
.
_flags
=
_hroll
(
self
.
_data
,
self
.
_flags
=
_hroll
(
data
=
self
.
_data
,
data
=
self
.
_data
,
field
=
field
,
field
=
field
,
flags
=
self
.
_flags
,
flags
=
self
.
_flags
,
target
=
kwargs
[
"
target
"
]
,
target
=
target
,
window
=
window
,
window
=
window
,
func
=
func
,
func
=
func
,
min_periods
=
min_periods
,
min_periods
=
min_periods
,
...
...
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